private async Task ReportSymbolInformationAsync(INavigateToSearchResult result, CancellationToken cancellationToken) { var location = await ProtocolConversions.TextSpanToLocationAsync( result.NavigableItem.Document, result.NavigableItem.SourceSpan, result.NavigableItem.IsStale, cancellationToken).ConfigureAwait(false); Contract.ThrowIfNull(location); _progress.Report(new VSSymbolInformation { Name = result.Name, ContainerName = result.AdditionalInformation, Kind = ProtocolConversions.NavigateToKindToSymbolKind(result.Kind), Location = location, Icon = ProtocolConversions.GetImageIdFromGlyph(result.NavigableItem.Glyph) }); }
internal static LSP.SymbolInformation CreateSymbolInformation(LSP.SymbolKind kind, string name, LSP.Location location, Glyph glyph, string?containerName = null) { var info = new LSP.VSSymbolInformation() { Kind = kind, Name = name, Location = location, Icon = ProtocolConversions.GetImageIdFromGlyph(glyph) }; if (containerName != null) { info.ContainerName = containerName; } return(info); }
/// <summary> /// Get a symbol information from a specified nav bar item. /// </summary> private static SymbolInformation?GetSymbolInformation( RoslynNavigationBarItem item, Document document, SourceText text, string?containerName = null) { if (item is not RoslynNavigationBarItem.SymbolItem symbolItem || symbolItem.Location.InDocumentInfo == null) { return(null); } return(new VSSymbolInformation { Name = item.Text, Location = new LSP.Location { Uri = document.GetURI(), Range = ProtocolConversions.TextSpanToRange(symbolItem.Location.InDocumentInfo.Value.navigationSpan, text), }, Kind = ProtocolConversions.GlyphToSymbolKind(item.Glyph), ContainerName = containerName, Icon = ProtocolConversions.GetImageIdFromGlyph(item.Glyph), }); }