@@ -14,6 +14,7 @@ open Microsoft.CodeAnalysis.Editor.Host
1414open Microsoft.CodeAnalysis .Navigation
1515open Microsoft.CodeAnalysis .FindSymbols
1616open Microsoft.CodeAnalysis .FindReferences
17+ open Microsoft.CodeAnalysis .Completion
1718
1819open Microsoft.VisualStudio .FSharp .LanguageService
1920
@@ -62,31 +63,32 @@ type internal FSharpFindReferencesService
6263let! symbol = CommonHelpers.getSymbolAtPosition( document.Id, sourceText, position, document.FilePath, defines, SymbolLookupKind.Fuzzy)
6364let! symbolUse = checkFileResults.GetSymbolUseAtLocation( lineNumber, symbol.RightColumn, textLine, [ symbol.Text])
6465let! declaration = checkFileResults.GetDeclarationLocationAlternate( lineNumber, symbol.RightColumn, textLine, [ symbol.Text], false ) |> liftAsync
66+ let tags = GlyphTags.GetTags( CommonRoslynHelpers.GetGlyphForSymbol symbolUse.Symbol)
6567
6668let declarationRange =
6769match declarationwith
6870| FSharpFindDeclResult.DeclFound range-> Some range
6971| _ -> None
7072
71- let! declarationSpans =
72- match declarationRange with
73- | Some range -> rangeToDocumentSpans ( document.Project.Solution , range , context.CancellationToken ) |> liftAsync
74- | None -> async.Return None
75-
76- let definitionItems =
77- match declarationSpans with
78- | [] ->
79- [ DefinitionItem.CreateNonNavigableItem (
80- ImmutableArray < string >. Empty ,
81- [ TaggedText ( TextTags.Text , symbolUse.Symbol.FullName )]. ToImmutableArray (),
82- [ TaggedText ( TextTags.Assembly , symbolUse.Symbol.Assembly.SimpleName )]. ToImmutableArray ()) ]
83- | _ ->
84- declarationSpans
85- |> List.map ( fun span ->
86- DefinitionItem.Create (
87- ImmutableArray < string >. Empty ,
88- [ TaggedText( TextTags.Text, symbolUse.Symbol.FullName )]. ToImmutableArray ( ),
89- span ))
73+ let! definitionItems =
74+ async {
75+ let! declarationSpans =
76+ match declarationRange with
77+ | Some range -> rangeToDocumentSpans ( document.Project.Solution , range , context.CancellationToken )
78+ | None -> async.Return []
79+
80+ return
81+ match declarationSpans with
82+ | [] ->
83+ [ DefinitionItem.CreateNonNavigableItem (
84+ tags ,
85+ ImmutableArray.Create ( TaggedText ( TextTags.Text , symbol.Text )),
86+ ImmutableArray.Create ( TaggedText ( TextTags.Assembly , symbolUse.Symbol.Assembly.SimpleName ))) ]
87+ | _ ->
88+ declarationSpans
89+ |> List.map ( fun span ->
90+ DefinitionItem.Create ( tags , ImmutableArray.Create ( TaggedText( TextTags.Text, symbol.Text ) ),span ))
91+ } |> liftAsync
9092
9193for definitionItemin definitionItemsdo
9294do ! context.OnDefinitionFoundAsync( definitionItem) |> Async.AwaitTask|> liftAsync