Ejemplo n.º 1
0
 public FindReferencesSearchEngine(
     Solution solution,
     IImmutableSet<Document> documents,
     ImmutableList<IReferenceFinder> finders,
     IFindReferencesProgress progress,
     CancellationToken cancellationToken)
 {
     this.documents = documents;
     this.solution = solution;
     this.finders = finders;
     this.progress = progress;
     this.cancellationToken = cancellationToken;
     this.dependencyGraph = solution.GetProjectDependencyGraph();
 }
Ejemplo n.º 2
0
 public FindReferencesSearchEngine(
     Solution solution,
     IImmutableSet<Document> documents,
     ImmutableArray<IReferenceFinder> finders,
     IFindReferencesProgress progress,
     CancellationToken cancellationToken)
 {
     _documents = documents;
     _solution = solution;
     _finders = finders;
     _progress = progress;
     _cancellationToken = cancellationToken;
     _dependencyGraph = solution.GetProjectDependencyGraph();
 }
 /// <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))
 {
     progress = progress ?? FindReferencesProgress.Instance;
     var streamingProgress = new StreamingProgressCollector(
         new StreamingFindReferencesProgressAdapter(progress));
     await FindReferencesAsync(
         SymbolAndProjectId.Create(symbol, projectId: null),
         solution, streamingProgress, documents, cancellationToken).ConfigureAwait(false);
     return streamingProgress.GetReferencedSymbols();
 }
Ejemplo n.º 5
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));
     }
 }
Ejemplo n.º 6
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 Task <IEnumerable <ReferencedSymbol> > FindReferencesAsync(
            ISymbol symbol,
            Solution solution,
            IFindReferencesProgress progress,
            IImmutableSet <Document> documents,
            CancellationToken cancellationToken = default)
        {
            if (solution.GetOriginatingProjectId(symbol) == null)
            {
                throw new ArgumentException(WorkspacesResources.Symbols_project_could_not_be_found_in_the_provided_solution, nameof(symbol));
            }

            return(FindReferencesAsync(
                       symbol, solution, progress, documents,
                       FindReferencesSearchOptions.Default, cancellationToken));
        }
Ejemplo n.º 7
0
        public FindReferencesSearchEngine(
            Solution solution,
            IImmutableSet <Document> documents,
            ImmutableArray <IReferenceFinder> finders,
            IFindReferencesProgress progress,
            CancellationToken cancellationToken)
        {
            _documents         = documents;
            _solution          = solution;
            _finders           = finders;
            _progress          = progress;
            _cancellationToken = cancellationToken;
            _dependencyGraph   = solution.GetProjectDependencyGraph();

            _progressTracker = new ProgressTracker(progress.ReportProgress);
        }
        /// <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)
        {
            progress = progress ?? FindReferencesProgress.Instance;
            var streamingProgress = new StreamingProgressCollector(
                new StreamingFindReferencesProgressAdapter(progress));

            await FindReferencesAsync(
                SymbolAndProjectId.Create(symbol, projectId: null),
                solution, streamingProgress, documents, cancellationToken).ConfigureAwait(false);

            return(streamingProgress.GetReferencedSymbols());
        }
Ejemplo n.º 9
0
 public static async Task <IEnumerable <ReferencedSymbol> > FindReferencesAsync(
     ISymbol symbol,
     Solution solution,
     IFindReferencesProgress progress,
     IImmutableSet <Document> documents,
     CancellationToken cancellationToken = default
     )
 {
     return(await FindReferencesAsync(
                symbol,
                solution,
                progress,
                documents,
                FindReferencesSearchOptions.Default,
                cancellationToken
                )
            .ConfigureAwait(false));
 }
Ejemplo n.º 10
0
 internal static Task <ImmutableArray <ReferencedSymbol> > FindReferencesAsync(
     ISymbol symbol,
     Solution solution,
     IFindReferencesProgress progress,
     IImmutableSet <Document> documents,
     FindReferencesSearchOptions options,
     CancellationToken cancellationToken
     )
 {
     return(SymbolFinder.FindReferencesAsync(
                symbol,
                solution,
                progress,
                documents,
                options,
                cancellationToken
                ));
 }
Ejemplo n.º 11
0
        private static async Task <ImmutableArray <ReferencedSymbol> > FindReferencesAsync(
            ISymbol symbol,
            Solution solution,
            IFindReferencesProgress progress,
            IImmutableSet <Document> documents,
            FindReferencesSearchOptions options,
            CancellationToken cancellationToken)
        {
            progress ??= NoOpFindReferencesProgress.Instance;
            var streamingProgress = new StreamingProgressCollector(
                new StreamingFindReferencesProgressAdapter(progress));

            await FindReferencesAsync(
                symbol, solution, streamingProgress, documents,
                options, cancellationToken).ConfigureAwait(false);

            return(streamingProgress.GetReferencedSymbols());
        }
Ejemplo n.º 12
0
        private static async Task <IEnumerable <ReferencedSymbol> > FindReferencesAsync(
            ISymbol symbol,
            Solution solution,
            IFindReferencesProgress progress,
            IImmutableSet <Document> documents,
            FindReferencesSearchOptions options,
            CancellationToken cancellationToken)
        {
            Contract.ThrowIfNull(solution.GetOriginatingProjectId(symbol), WorkspacesResources.Symbols_project_could_not_be_found_in_the_provided_solution);

            progress ??= NoOpFindReferencesProgress.Instance;
            var streamingProgress = new StreamingProgressCollector(
                new StreamingFindReferencesProgressAdapter(progress));

            await FindReferencesAsync(
                symbol, solution, streamingProgress, documents,
                options, cancellationToken).ConfigureAwait(false);

            return(streamingProgress.GetReferencedSymbols());
        }
 public ProgressWrapper(IFindReferencesProgress progress, int maximum)
 {
     this.progress = progress;
     this.maximum = maximum;
 }
 public ProgressWrapper(IFindReferencesProgress progress, int maximum)
 {
     _progress = progress;
     _maximum = maximum;
 }
 public ProgressWrapper(IFindReferencesProgress progress, int maximum)
 {
     this.progress = progress;
     this.maximum  = maximum;
 }
 public ProgressWrapper(IFindReferencesProgress progress, int maximum)
 {
     _progress = progress;
     _maximum  = maximum;
 }
Ejemplo n.º 17
0
 public StreamingFindReferencesProgressAdapter(IFindReferencesProgress progress)
 {
     _progress = progress;
 }
 public StreamingFindReferencesProgressAdapter(IFindReferencesProgress progress)
 {
     _progress = progress;
 }