Ejemplo n.º 1
0
        public static async Task <IEnumerable <ISymbol> > FindSourceDeclarationsWithPatternAsync(
            Project project,
            string pattern,
            SymbolFilter filter,
            CancellationToken cancellationToken = default
            )
        {
            using (
                Logger.LogBlock(
                    FunctionId.SymbolFinder_Project_Pattern_FindSourceDeclarationsAsync,
                    cancellationToken
                    )
                )
            {
                var declarations = await DeclarationFinder
                                   .FindSourceDeclarationsWithPatternAsync(
                    project,
                    pattern,
                    filter,
                    cancellationToken
                    )
                                   .ConfigureAwait(false);

                return(declarations);
            }
        }
        /// <summary>
        /// Find the symbols for declarations made in source with the specified pattern. This pattern is matched
        /// using heuristics that may change from release to release. So, the set of symbols matched by a given
        /// pattern may change between releases. For example, new symbols may be matched by a pattern and/or
        /// symbols previously matched by a pattern no longer are. However, the set of symbols matched by a
        /// specific release will be consistent for a specific pattern.
        /// </summary>
        public static async Task <IEnumerable <ISymbol> > FindSourceDeclarationsWithPatternAsync(
            Solution solution, string pattern, SymbolFilter filter, CancellationToken cancellationToken = default)
        {
            using (Logger.LogBlock(FunctionId.SymbolFinder_Solution_Pattern_FindSourceDeclarationsAsync, cancellationToken))
            {
                var declarations = await DeclarationFinder.FindSourceDeclarationsWithPatternAsync(
                    solution, pattern, filter, cancellationToken).ConfigureAwait(false);

                return(declarations.SelectAsArray(t => t.Symbol));
            }
        }