private static async Task <IEnumerable <ISymbol> > FindSourceDeclarationsithNormalQueryInLocalProcessAsync(
            Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken)
        {
            if (project == null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                return(SpecializedCollections.EmptyEnumerable <ISymbol>());
            }

            var list = ArrayBuilder <ISymbol> .GetInstance();

            await AddCompilationDeclarationsWithNormalQueryAsync(
                project, SearchQuery.Create(name, ignoreCase), filter, list, cancellationToken).ConfigureAwait(false);

            return(list.ToImmutableAndFree());
        }
        private static async Task <ImmutableArray <ISymbol> > FindSourceDeclarationsWithNormalQueryAsync(
            Solution solution, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken)
        {
            if (solution == null)
            {
                throw new ArgumentNullException(nameof(solution));
            }

            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                return(ImmutableArray <ISymbol> .Empty);
            }

            var query  = SearchQuery.Create(name, ignoreCase);
            var result = ArrayBuilder <ISymbol> .GetInstance();

            foreach (var projectId in solution.ProjectIds)
            {
                var project = solution.GetProject(projectId);
                await AddCompilationDeclarationsWithNormalQueryAsync(
                    project, query, filter, result, cancellationToken).ConfigureAwait(false);
            }

            return(result.ToImmutableAndFree());
        }
            > FindSourceDeclarationsWithNormalQueryInCurrentProcessAsync(
            Solution solution,
            string name,
            bool ignoreCase,
            SymbolFilter criteria,
            CancellationToken cancellationToken
            )
        {
            using var query = SearchQuery.Create(name, ignoreCase);

            var result = ArrayBuilder <ISymbol> .GetInstance();

            foreach (var projectId in solution.ProjectIds)
            {
                var project = solution.GetProject(projectId);
                await AddCompilationDeclarationsWithNormalQueryAsync(
                    project,
                    query,
                    criteria,
                    result,
                    cancellationToken
                    )
                .ConfigureAwait(false);
            }

            return(result.ToImmutableAndFree());
        }
Exemplo n.º 4
0
        /// <summary>
        /// Find the declared symbols from either source, referenced projects or metadata assemblies with the specified name.
        /// </summary>
        public static async Task <IEnumerable <ISymbol> > FindDeclarationsAsync(
            Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken))
        {
            var declarations = await DeclarationFinder.FindAllDeclarationsWithNormalQueryAsync(
                project, SearchQuery.Create(name, ignoreCase), filter, cancellationToken).ConfigureAwait(false);

            return(declarations.SelectAsArray(t => t.Symbol));
        }
Exemplo n.º 5
0
        public static async Task <IEnumerable <ISymbol> > FindDeclarationsAsync(
            Project project, string name, bool ignoreCase, CancellationToken cancellationToken = default)
        {
            using var query = SearchQuery.Create(name, ignoreCase);
            var declarations = await DeclarationFinder.FindAllDeclarationsWithNormalQueryAsync(
                project, query, SymbolFilter.All, cancellationToken).ConfigureAwait(false);

            return(declarations);
        }
        internal static async Task <ImmutableArray <SymbolAndProjectId> > FindSourceDeclarationsWithNormalQueryInCurrentProcessAsync(
            Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken)
        {
            var list = ArrayBuilder <SymbolAndProjectId> .GetInstance();

            await AddCompilationDeclarationsWithNormalQueryAsync(
                project, SearchQuery.Create(name, ignoreCase),
                filter, list, cancellationToken).ConfigureAwait(false);

            return(list.ToImmutableAndFree());
        }
        internal static async Task <ImmutableArray <ISymbol> > FindSourceDeclarationsWithNormalQueryInCurrentProcessAsync(
            Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken)
        {
            using var _ = ArrayBuilder <ISymbol> .GetInstance(out var result);

            using var query = SearchQuery.Create(name, ignoreCase);

            await AddCompilationDeclarationsWithNormalQueryAsync(
                project, query, filter, result, cancellationToken).ConfigureAwait(false);

            return(result.ToImmutable());
        }
Exemplo n.º 8
0
        /// <summary>
        /// Find the declared symbols from either source, referenced projects or metadata assemblies with the specified name.
        /// </summary>
        public static Task <IEnumerable <ISymbol> > FindDeclarationsAsync(Project project, string name, bool ignoreCase, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                return(SpecializedTasks.EmptyEnumerable <ISymbol>());
            }

            return(FindDeclarationsAsync(project, SearchQuery.Create(name, ignoreCase), cancellationToken: cancellationToken));
        }
        /// <summary>
        /// Find the declared symbols from either source, referenced projects or metadata assemblies with the specified name.
        /// </summary>
        public static async Task <IEnumerable <ISymbol> > FindDeclarationsAsync(
            Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                return(ImmutableArray <ISymbol> .Empty);
            }

            return(await FindDeclarationsAsync(
                       project, SearchQuery.Create(name, ignoreCase), filter, cancellationToken : cancellationToken).ConfigureAwait(false));
        }
Exemplo n.º 10
0
        /// <summary>
        /// Find the declared symbols from either source, referenced projects or metadata assemblies with the specified name.
        /// </summary>
        internal static async Task <ImmutableArray <SymbolAndProjectId> > FindAllDeclarationsAsync(
            Project project, string name, bool ignoreCase, CancellationToken cancellationToken)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                return(ImmutableArray <SymbolAndProjectId> .Empty);
            }

            return(await FindAllDeclarationsWithNormalQueryAsync(
                       project, SearchQuery.Create(name, ignoreCase), SymbolFilter.All, cancellationToken : cancellationToken).ConfigureAwait(false));
        }
Exemplo n.º 11
0
        /// <summary>
        /// Find the symbols for declarations made in source with the specified name.
        /// </summary>
        public static Task <IEnumerable <ISymbol> > FindSourceDeclarationsAsync(Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (project == null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                return(SpecializedTasks.EmptyEnumerable <ISymbol>());
            }

            using (Logger.LogBlock(FunctionId.SymbolFinder_Project_Name_FindSourceDeclarationsAsync, cancellationToken))
            {
                return(FindSourceDeclarationsAsyncImpl(project, SearchQuery.Create(name, ignoreCase), filter, cancellationToken));
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Find the symbols for declarations made in source with the specified name.
        /// </summary>
        public static async Task <IEnumerable <ISymbol> > FindSourceDeclarationsAsync(
            Solution solution, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (solution == null)
            {
                throw new ArgumentNullException(nameof(solution));
            }

            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                return(ImmutableArray <ISymbol> .Empty);
            }

            using (Logger.LogBlock(FunctionId.SymbolFinder_Solution_Name_FindSourceDeclarationsAsync, cancellationToken))
            {
                return(await FindSourceDeclarationsAsyncImpl(
                           solution, SearchQuery.Create(name, ignoreCase), filter, cancellationToken).ConfigureAwait(false));
            }
        }