private async Task CreateMissingReferenceEntriesIfNecessaryAsync( bool whenGroupingByDefinition) { // Go through and add dummy entries for any definitions that // that we didn't find any references for. var definitions = GetDefinitionsToCreateMissingReferenceItemsFor(whenGroupingByDefinition); foreach (var definition in definitions) { if (definition.IsExternal) { await OnEntryFoundAsync(definition, bucket => SimpleMessageEntry.CreateAsync(bucket, bucket, ServicesVSResources.External_reference_found) !, addToEntriesWhenGroupingByDefinition : whenGroupingByDefinition, addToEntriesWhenNotGroupingByDefinition : !whenGroupingByDefinition).ConfigureAwait(false); } else { // Create a fake reference to this definition that says "no references found to <symbolname>". // // We'll place this under a single bucket called "Symbols without references" and we'll allow // the user to navigate on that text entry to that definition if possible. await OnEntryFoundAsync(SymbolsWithoutReferencesDefinitionItem, bucket => SimpleMessageEntry.CreateAsync( definitionBucket: bucket, navigationBucket: RoslynDefinitionBucket.Create(Presenter, this, definition, expandedByDefault: false), string.Format(ServicesVSResources.No_references_found_to_0, definition.NameDisplayParts.JoinText())) !, addToEntriesWhenGroupingByDefinition : whenGroupingByDefinition, addToEntriesWhenNotGroupingByDefinition : !whenGroupingByDefinition, expandedByDefault : false).ConfigureAwait(false); } } }
protected RoslynDefinitionBucket GetOrCreateDefinitionBucket(DefinitionItem definition) { lock (Gate) { if (!_definitionToBucket.TryGetValue(definition, out var bucket)) { bucket = RoslynDefinitionBucket.Create(Presenter, this, definition); _definitionToBucket.Add(definition, bucket); } return(bucket); } }