예제 #1
0
 internal static Task FindReferencesInCurrentProcessAsync(
     SymbolAndProjectId symbolAndProjectId, Solution solution,
     IStreamingFindReferencesProgress progress, IImmutableSet<Document> documents,
     CancellationToken cancellationToken)
 {
     var finders = ReferenceFinders.DefaultReferenceFinders;
     progress = progress ?? StreamingFindReferencesProgress.Instance;
     var engine = new FindReferencesSearchEngine(
         solution, documents, finders, progress, cancellationToken);
     return engine.FindReferencesAsync(symbolAndProjectId);
 }
        internal static Task FindReferencesInCurrentProcessAsync(
            SymbolAndProjectId symbolAndProjectId, Solution solution,
            IStreamingFindReferencesProgress progress, IImmutableSet <Document> documents,
            FindReferencesSearchOptions options, CancellationToken cancellationToken)
        {
            var finders = ReferenceFinders.DefaultReferenceFinders;

            progress = progress ?? StreamingFindReferencesProgress.Instance;
            var engine = new FindReferencesSearchEngine(
                solution, documents, finders, progress, options, cancellationToken);

            return(engine.FindReferencesAsync(symbolAndProjectId));
        }
예제 #3
0
 /// <summary>
 /// Finds all references to a symbol throughout a solution
 /// </summary>
 /// <param name="symbol">The symbol to find references to.</param>
 /// <param name="solution">The solution to find references within.</param>
 /// <param name="progress">An optional progress object that will receive progress
 /// information as the search is undertaken.</param>
 /// <param name="documents">An optional set of documents to be searched. If documents is null, then that means "all documents".</param>
 /// <param name="cancellationToken">An optional cancellation token.</param>
 public static async Task <IEnumerable <ReferencedSymbol> > FindReferencesAsync(
     ISymbol symbol,
     Solution solution,
     IFindReferencesProgress progress,
     IImmutableSet <Document> documents,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     using (Logger.LogBlock(FunctionId.FindReference, cancellationToken))
     {
         var finders = ReferenceFinders.DefaultReferenceFinders;
         progress = progress ?? FindReferencesProgress.Instance;
         var engine = new FindReferencesSearchEngine(solution, documents, finders, progress, cancellationToken);
         return(await engine.FindReferencesAsync(symbol).ConfigureAwait(false));
     }
 }
 /// <summary>
 /// Finds all references to a symbol throughout a solution
 /// </summary>
 /// <param name="symbol">The symbol to find references to.</param>
 /// <param name="solution">The solution to find references within.</param>
 /// <param name="progress">An optional progress object that will receive progress
 /// information as the search is undertaken.</param>
 /// <param name="documents">An optional set of documents to be searched. If documents is null, then that means "all documents".</param>
 /// <param name="cancellationToken">An optional cancellation token.</param>
 public static async Task<IEnumerable<ReferencedSymbol>> FindReferencesAsync(
     ISymbol symbol,
     Solution solution,
     IFindReferencesProgress progress,
     IImmutableSet<Document> documents,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     using (Logger.LogBlock(FunctionId.FindReference, cancellationToken))
     {
         var finders = ReferenceFinders.DefaultReferenceFinders;
         progress = progress ?? FindReferencesProgress.Instance;
         var engine = new FindReferencesSearchEngine(solution, documents, finders, progress, cancellationToken);
         return await engine.FindReferencesAsync(symbol).ConfigureAwait(false);
     }
 }
예제 #5
0
 internal static async Task FindReferencesAsync(
     SymbolAndProjectId symbolAndProjectId,
     Solution solution,
     IStreamingFindReferencesProgress progress,
     IImmutableSet <Document> documents,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     using (Logger.LogBlock(FunctionId.FindReference, cancellationToken))
     {
         var finders = ReferenceFinders.DefaultReferenceFinders;
         progress = progress ?? StreamingFindReferencesProgress.Instance;
         var engine = new FindReferencesSearchEngine(
             solution, documents, finders, progress, cancellationToken);
         await engine.FindReferencesAsync(symbolAndProjectId).ConfigureAwait(false);
     }
 }
        internal static Task<IEnumerable<ReferencedSymbol>> FindRenamableReferencesAsync(
            ISymbol symbol,
            Solution solution,
            CancellationToken cancellationToken)
        {
            using (Logger.LogBlock(FunctionId.FindReference_Rename, cancellationToken))
            {
                IImmutableSet<Document> documents = null;
                var engine = new FindReferencesSearchEngine(
                    solution,
                    documents,
                    ReferenceFinders.DefaultRenameReferenceFinders,
                    FindReferencesProgress.Instance,
                    cancellationToken);

                return engine.FindReferencesAsync(symbol);
            }
        }
예제 #7
0
        internal static async Task <IEnumerable <ReferencedSymbol> > FindRenamableReferencesAsync(
            SymbolAndProjectId symbolAndProjectId,
            Solution solution,
            CancellationToken cancellationToken)
        {
            using (Logger.LogBlock(FunctionId.FindReference_Rename, cancellationToken))
            {
                IImmutableSet <Document> documents = null;
                var engine = new FindReferencesSearchEngine(
                    solution,
                    documents,
                    ReferenceFinders.DefaultRenameReferenceFinders,
                    StreamingFindReferencesProgress.Instance,
                    cancellationToken);

                return(await engine.FindReferencesAsync(symbolAndProjectId).ConfigureAwait(false));
            }
        }
예제 #8
0
        internal static Task <IEnumerable <ReferencedSymbol> > FindRenamableReferencesAsync(
            ISymbol symbol,
            Solution solution,
            CancellationToken cancellationToken)
        {
            using (Logger.LogBlock(FunctionId.FindReference_Rename, cancellationToken))
            {
                IImmutableSet <Document> documents = null;
                var engine = new FindReferencesSearchEngine(
                    solution,
                    documents,
                    ReferenceFinders.DefaultRenameReferenceFinders,
                    FindReferencesProgress.Instance,
                    cancellationToken);

                return(engine.FindReferencesAsync(symbol));
            }
        }
예제 #9
0
        internal static async Task <ImmutableArray <ReferencedSymbol> > FindRenamableReferencesAsync(
            ImmutableArray <ISymbol> symbols,
            Solution solution,
            CancellationToken cancellationToken)
        {
            using (Logger.LogBlock(FunctionId.FindReference_Rename, cancellationToken))
            {
                var streamingProgress = new StreamingProgressCollector();

                var engine = new FindReferencesSearchEngine(
                    solution,
                    documents: null,
                    ReferenceFinders.DefaultRenameReferenceFinders,
                    streamingProgress,
                    FindReferencesSearchOptions.Default);

                await engine.FindReferencesAsync(symbols, cancellationToken).ConfigureAwait(false);

                return(streamingProgress.GetReferencedSymbols());
            }
        }
        internal static async Task <ImmutableArray <ReferencedSymbol> > FindRenamableReferencesAsync(
            SymbolAndProjectId symbolAndProjectId,
            Solution solution,
            CancellationToken cancellationToken)
        {
            using (Logger.LogBlock(FunctionId.FindReference_Rename, cancellationToken))
            {
                var streamingProgress = new StreamingProgressCollector(
                    StreamingFindReferencesProgress.Instance);

                IImmutableSet <Document> documents = null;
                var engine = new FindReferencesSearchEngine(
                    solution,
                    documents,
                    ReferenceFinders.DefaultRenameReferenceFinders,
                    streamingProgress,
                    FindReferencesSearchOptions.Default,
                    cancellationToken);

                await engine.FindReferencesAsync(symbolAndProjectId).ConfigureAwait(false);

                return(streamingProgress.GetReferencedSymbols());
            }
        }
        private static Task<IEnumerable<ReferencedSymbol>> FindChangeSignatureReferencesAsync(
            ISymbol symbol,
            Solution solution,
            CancellationToken cancellationToken)
        {
            using (Logger.LogBlock(FunctionId.FindReference_ChangeSignature, cancellationToken))
            {
                IImmutableSet<Document> documents = null;
                var engine = new FindReferencesSearchEngine(
                    solution,
                    documents,
                    ReferenceFinders.DefaultReferenceFinders.Add(DelegateInvokeMethodReferenceFinder.DelegateInvokeMethod),
                    FindReferencesProgress.Instance,
                    cancellationToken);

                return engine.FindReferencesAsync(symbol);
            }
        }
        internal static async Task<ImmutableArray<ReferencedSymbol>> FindRenamableReferencesAsync(
            SymbolAndProjectId symbolAndProjectId,
            Solution solution,
            CancellationToken cancellationToken)
        {
            using (Logger.LogBlock(FunctionId.FindReference_Rename, cancellationToken))
            {
                var streamingProgress = new StreamingProgressCollector(
                    StreamingFindReferencesProgress.Instance);

                IImmutableSet<Document> documents = null;
                var engine = new FindReferencesSearchEngine(
                    solution,
                    documents,
                    ReferenceFinders.DefaultRenameReferenceFinders,
                    streamingProgress,
                    cancellationToken);

                await engine.FindReferencesAsync(symbolAndProjectId).ConfigureAwait(false);
                return streamingProgress.GetReferencedSymbols();
            }
        }