private async Task FindSymbolsInDocument(
            INavigateToSearchService searchService, Document document,
            string searchPattern,
            ImmutableArray <SymbolInformation> .Builder resultsBuilder)
        {
            var foundSymbols = await searchService.SearchDocumentAsync(document, searchPattern, CancellationToken.None);

            resultsBuilder.AddRange(foundSymbols
                                    .Select(r => new SymbolInformation
            {
                ContainerName = r.AdditionalInformation,
                Kind          = GetSymbolKind(r.Kind),
                Location      = new Location
                {
                    Uri   = GetFileUri(r.NavigableItem.SourceSpan.File.FilePath),
                    Range = ConvertTextSpanToRange(r.NavigableItem.SourceSpan.File.Text, r.NavigableItem.SourceSpan.Span)
                },
                Name = r.Name
            }));
        }
示例#2
0
        public static async Task FindSymbolsInDocument <TSymbolInformation>(
            INavigateToSearchService searchService,
            LogicalDocument document,
            string searchPattern,
            CancellationToken cancellationToken,
            ImmutableArray <TSymbolInformation> .Builder resultsBuilder)
            where TSymbolInformation : ISymbolInformation, new()
        {
            var foundSymbols = await searchService.SearchDocumentAsync(document, searchPattern, cancellationToken);

            resultsBuilder.AddRange(foundSymbols
                                    .Select(r => new TSymbolInformation
            {
                ContainerName = r.AdditionalInformation,
                Kind          = GetSymbolKind(r.Kind),
                Location      = new Location
                {
                    Uri   = Helpers.ToUri(r.NavigableItem.SourceSpan.File.FilePath),
                    Range = Helpers.ToRange(r.NavigableItem.Document, r.NavigableItem.SourceSpan.Span)
                },
                Name = r.Name
            }));
        }
 public ShimNavigateToSearchService(INavigateToSearchService navigateToSearchService)
 {
     _navigateToSearchService = navigateToSearchService;
 }