private static async Task <VSSymbolInformation[]> ConvertAsync( ImmutableArray <INavigateToSearchResult> results, CancellationToken cancellationToken) { var symbols = new VSSymbolInformation[results.Length]; for (var i = 0; i < results.Length; i++) { var result = results[i]; var text = await result.NavigableItem.Document.GetTextAsync(cancellationToken).ConfigureAwait(false); symbols[i] = new VSSymbolInformation() { Name = result.Name, ContainerName = result.AdditionalInformation, Kind = ProtocolConversions.NavigateToKindToSymbolKind(result.Kind), Location = new LSP.Location() { Uri = result.NavigableItem.Document.GetURI(), Range = ProtocolConversions.TextSpanToRange(result.NavigableItem.SourceSpan, text) }, Icon = new VisualStudio.Text.Adornments.ImageElement(result.NavigableItem.Glyph.GetImageId()) }; } return(symbols); }
public void SetSymbols() { List <VSSymbolInformation> symbols = new List <VSSymbolInformation>(); foreach (SymbolInformationItem item in this.Symbols) { var symbol = new VSSymbolInformation() { Name = item.Name, Kind = item.Kind, ContainerName = item.Container, }; symbols.Add(symbol); } this.languageServer.SetDocumentSymbols(symbols); }