anchor.diff:  open Microsoft.FSharp.Compiler.SourceCodeServices
   open Symbols
   
  -
   module private UnusedOpens =
  -    
  -
  -    let rec visitSynModuleOrNamespaceDecls (parent: Ast.LongIdent) decls : (Set<string> * range) list =
  +    /// Represents single open statement.
  +    type OpenStatement =
  +        { /// Open namespace or module effective names.
  +          Names: Set<string>
  +          /// Range of open statement itself.
  +          Range: range
  +          /// Enclosing module or namespace range (that is, the scope on in which this open statement is visible).
  +          ModuleRange: range }
  +
  +    let rec visitSynModuleOrNamespaceDecls (parent: Ast.LongIdent) (decls: SynModuleDecls) (moduleRange: range) : OpenStatement list =
           [ for decl in decls do
               match decl with
               | SynModuleDecl.Open(LongIdentWithDots.LongIdentWithDots(id = longId), range) ->
                   yield
  -                    set [ yield (longId |> List.map(fun l -> l.idText) |> String.concat ".")
  -                          // `open N.M` can open N.M module from parent module as well, if it's non empty
  -                          if not (List.isEmpty parent) then
  -                            yield (parent @ longId |> List.map(fun l -> l.idText) |> String.concat ".") ], range
  -            | SynModuleDecl.NestedModule(SynComponentInfo.ComponentInfo(longId = longId),_, decls,_,_) ->
  -                yield! visitSynModuleOrNamespaceDecls longId decls
  +                    { Names = 
  +                          set [ yield (longId |> List.map(fun l -> l.idText) |> String.concat ".")
  +                                // `open N.M` can open N.M module from parent module as well, if it's non empty
  +                                if not (List.isEmpty parent) then
  +                                    yield (parent @ longId |> List.map(fun l -> l.idText) |> String.concat ".") ]
  +                      Range = range
  +                      ModuleRange = moduleRange }
  +
  +            | SynModuleDecl.NestedModule(SynComponentInfo.ComponentInfo(longId = longId),_, decls,_,moduleRange) ->
  +                yield! visitSynModuleOrNamespaceDecls longId decls moduleRange
               | _ -> () ]
   
  -    let getOpenStatements = function
  +    let getOpenStatements (parsedInput: ParsedInput) : OpenStatement list = 
  +        match parsedInput with
           | ParsedInput.ImplFile (ParsedImplFileInput(modules = modules)) ->
               [ for md in modules do
  -                let SynModuleOrNamespace(longId = longId; decls = decls) = md
  -                yield! visitSynModuleOrNamespaceDecls longId decls ]
  +                let SynModuleOrNamespace(longId = longId; decls = decls; range = moduleRange) = md
  +                yield! visitSynModuleOrNamespaceDecls longId decls moduleRange ]
           | _ -> []
   
       let getAutoOpenAccessPath (ent:FSharpEntity) =
  
positive.code:         | Some (island, _, _) -> island = fullName
          | None -> false
  
      let getUnusedOpens (sourceText: SourceText) (parsedInput: ParsedInput) (symbolUses: FSharpSymbolUse[]) =
  
          let getPartNamespace (symbolUse: FSharpSymbolUse) (fullName: string) =
              // given a symbol range such as `Text.ISegment` and a full name of `MonoDevelop.Core.Text.ISegment`, return `MonoDevelop.Core`
  
negative.code:             
              return 
                  unusedOpens
                  |> List.map (fun range ->
                        Diagnostic.Create(
                           Descriptor,
                           RoslynHelpers.RangeToLocation(range, sourceText, document.FilePath)))
                  |> Seq.toImmutableArray
          } 
          |> Async.map (Option.defaultValue ImmutableArray.Empty)
  