@@ -58,12 +58,16 @@ module UnusedOpens =
5858
5959let filterSymbolUses ( getSourceLineStr : int -> string ) ( symbolUses : FSharpSymbolUse []) : FSharpSymbolUse [] =
6060 symbolUses
61- |> Array.filter( fun su -> not su.IsFromDefinition)
6261|> Array.filter( fun su ->
6362match su.Symbolwith
64- | :? FSharpMemberOrFunctionOrValueas fvwhen fv.IsExtensionMember-> true
63+ | :? FSharpMemberOrFunctionOrValueas fvwhen fv.IsExtensionMember->
64+ // extension members should be taken into account even though they have a prefix (as they do most of the time)
65+ true
6566| _ ->
6667let partialName = QuickParse.GetPartialLongNameEx( getSourceLineStr su.RangeAlternate.StartLine, su.RangeAlternate.EndColumn- 1 )
68+ // for the rest of symbols we pick only those which are the first part of a long idend, because it's they which are
69+ // conteined in opened namespaces / modules. For example, we pick `IO` from long ident `IO.File.OpenWrite` because
70+ // it's `open System` which really brings it into scope.
6771 partialName.QualifyingIdents= [])
6872
6973let getUnusedOpens ( checkFileResults : FSharpCheckFileResults , getSourceLineStr : int -> string ) : Async < range list > =