public async Task <ImmutableArray <SymbolAndProjectId> > FindAsync( SearchQuery query, AsyncLazy <IAssemblySymbol> lazyAssembly, ProjectId assemblyProjectId, SymbolFilter filter, CancellationToken cancellationToken) { // All entrypoints to this function are Find functions that are only searching // for specific strings (i.e. they never do a custom search). Contract.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API"); var symbols = await FindAsyncWorker(query, lazyAssembly, cancellationToken).ConfigureAwait(false); return(DeclarationFinder.FilterByCriteria( symbols.SelectAsArray(s => new SymbolAndProjectId(s, assemblyProjectId)), filter)); }
public static async Task <IEnumerable <ISymbol> > FindDeclarationsAsync( Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken = default ) { using var query = SearchQuery.Create(name, ignoreCase); var declarations = await DeclarationFinder .FindAllDeclarationsWithNormalQueryAsync(project, query, filter, cancellationToken) .ConfigureAwait(false); return(declarations); }
> FindSourceDeclarationsWithCustomQueryAsync( Project project, SearchQuery query, SymbolFilter filter, CancellationToken cancellationToken ) { if (project == null) { throw new ArgumentNullException(nameof(project)); } if (query.Name != null && string.IsNullOrWhiteSpace(query.Name)) { return(ImmutableArray <ISymbol> .Empty); } using ( Logger.LogBlock( FunctionId.SymbolFinder_Project_Predicate_FindSourceDeclarationsAsync, cancellationToken ) ) { if ( await project .ContainsSymbolsWithNameAsync( query.GetPredicate(), filter, cancellationToken ) .ConfigureAwait(false) ) { var compilation = await project .GetCompilationAsync(cancellationToken) .ConfigureAwait(false); var unfiltered = compilation .GetSymbolsWithName(query.GetPredicate(), filter, cancellationToken) .ToImmutableArray(); return(DeclarationFinder.FilterByCriteria(unfiltered, filter)); } } return(ImmutableArray <ISymbol> .Empty); }