private static async Task FindImplementationsInCurrentProcessAsync( ISymbol symbol, Project project, IFindUsagesContext context, CancellationToken cancellationToken) { await context.SetSearchTitleAsync( string.Format(FeaturesResources._0_implementations, FindUsagesHelpers.GetDisplayName(symbol)), cancellationToken).ConfigureAwait(false); var solution = project.Solution; var implementations = await FindSourceImplementationsAsync(solution, symbol, cancellationToken).ConfigureAwait(false); if (implementations.IsEmpty) { await context.ReportMessageAsync(FeaturesResources.The_symbol_has_no_implementations, cancellationToken).ConfigureAwait(false); return; } foreach (var implementation in implementations) { var definitionItem = await implementation.ToClassifiedDefinitionItemAsync( context, solution, FindReferencesSearchOptions.Default, isPrimary : true, includeHiddenLocations : false, cancellationToken).ConfigureAwait(false); await context.OnDefinitionFoundAsync(definitionItem, cancellationToken).ConfigureAwait(false); } }
/// <summary> /// Public helper that we use from features like ObjectBrowser which start with a symbol /// and want to push all the references to it into the Streaming-Find-References window. /// </summary> public static async Task FindSymbolReferencesAsync( IFindUsagesContext context, ISymbol symbol, Project project, CancellationToken cancellationToken) { await context.SetSearchTitleAsync( string.Format(FeaturesResources._0_references, FindUsagesHelpers.GetDisplayName(symbol)), cancellationToken).ConfigureAwait(false); var options = FindReferencesSearchOptions.GetFeatureOptionsForStartingSymbol(symbol); // Now call into the underlying FAR engine to find reference. The FAR // engine will push results into the 'progress' instance passed into it. // We'll take those results, massage them, and forward them along to the // FindReferencesContext instance we were given. await FindReferencesAsync(context, symbol, project, options, cancellationToken).ConfigureAwait(false); }