public async Task FindReferencesAsync(SerializableSymbolAndProjectId symbolAndProjectIdArg, DocumentId[] documentArgs) { var solution = await GetSolutionAsync().ConfigureAwait(false); var symbolAndProjectId = await symbolAndProjectIdArg.TryRehydrateAsync( solution, CancellationToken).ConfigureAwait(false); var progressCallback = new FindReferencesProgressCallback(this); if (!symbolAndProjectId.HasValue) { await progressCallback.OnStartedAsync().ConfigureAwait(false); await progressCallback.OnCompletedAsync().ConfigureAwait(false); return; } var documents = documentArgs?.Select(solution.GetDocument) .ToImmutableHashSet(); await SymbolFinder.FindReferencesInCurrentProcessAsync( symbolAndProjectId.Value, solution, progressCallback, documents, CancellationToken).ConfigureAwait(false); }
public Task FindReferencesAsync(SerializableSymbolAndProjectId symbolAndProjectIdArg, DocumentId[] documentArgs, CancellationToken cancellationToken) { return(RunServiceAsync(async() => { using (UserOperationBooster.Boost()) { var solution = await GetSolutionAsync(cancellationToken).ConfigureAwait(false); var symbolAndProjectId = await symbolAndProjectIdArg.TryRehydrateAsync( solution, cancellationToken).ConfigureAwait(false); var progressCallback = new FindReferencesProgressCallback(this); if (!symbolAndProjectId.HasValue) { await progressCallback.OnStartedAsync().ConfigureAwait(false); await progressCallback.OnCompletedAsync().ConfigureAwait(false); return; } // NOTE: In projection scenarios, we might get a set of documents to search // that are not all the same language and might not exist in the OOP process // (like the JS parts of a .cshtml file). Filter them out here. This will // need to be revisited if we someday support FAR between these languages. var documents = documentArgs?.Select(solution.GetDocument) .WhereNotNull() .ToImmutableHashSet(); await SymbolFinder.FindReferencesInCurrentProcessAsync( symbolAndProjectId.Value, solution, progressCallback, documents, cancellationToken).ConfigureAwait(false); } }, cancellationToken)); }