private async Task CreateNoResultsFoundEntryIfNecessaryAsync() { string message; lock (Gate) { // If we got definitions, then no need to show the 'no results found' message. if (this.Definitions.Count > 0) { return; } message = NoDefinitionsFoundMessage; } var definitionBucket = GetOrCreateDefinitionBucket(CreateNoResultsDefinitionItem(message), expandedByDefault: true); var entry = await SimpleMessageEntry.CreateAsync(definitionBucket, navigationBucket : null, message).ConfigureAwait(false); lock (Gate) { EntriesWhenGroupingByDefinition = EntriesWhenGroupingByDefinition.Add(entry); EntriesWhenNotGroupingByDefinition = EntriesWhenNotGroupingByDefinition.Add(entry); CurrentVersionNumber++; } NotifyChange(); }
private async ValueTask OnEntryFoundAsync( DefinitionItem definition, Func <RoslynDefinitionBucket, Task <Entry?> > createEntryAsync, bool addToEntriesWhenGroupingByDefinition, bool addToEntriesWhenNotGroupingByDefinition, bool expandedByDefault = true ) { Debug.Assert( addToEntriesWhenGroupingByDefinition || addToEntriesWhenNotGroupingByDefinition ); CancellationToken.ThrowIfCancellationRequested(); // OK, we got a *reference* to some definition item. This may have been a reference for some definition // that we haven't created any declaration entries for (i.e. because it had DisplayIfNoReferences = // false). Because we've now found a reference, we want to make sure all its declaration entries are // added. await AddDeclarationEntriesAsync(definition, expandedByDefault) .ConfigureAwait(false); // First find the bucket corresponding to our definition. var definitionBucket = GetOrCreateDefinitionBucket(definition, expandedByDefault); var entry = await createEntryAsync(definitionBucket).ConfigureAwait(false); // Proceed, even if we didn't create an entry. It's possible that we augmented // an existing entry and we want the UI to refresh to show the results of that. lock (Gate) { if (entry != null) { // Once we can make the new entry, add it to the appropriate list. if (addToEntriesWhenGroupingByDefinition) { EntriesWhenGroupingByDefinition = EntriesWhenGroupingByDefinition.Add( entry ); } if (addToEntriesWhenNotGroupingByDefinition) { EntriesWhenNotGroupingByDefinition = EntriesWhenNotGroupingByDefinition.Add(entry); } } CurrentVersionNumber++; } // Let all our subscriptions know that we've updated. NotifyChange(); }
protected async Task OnEntryFoundAsync( DefinitionItem definition, Func <RoslynDefinitionBucket, Task <Entry> > createEntryAsync, bool addToEntriesWhenGroupingByDefinition, bool addToEntriesWhenNotGroupingByDefinition) { Debug.Assert(addToEntriesWhenGroupingByDefinition || addToEntriesWhenNotGroupingByDefinition); CancellationToken.ThrowIfCancellationRequested(); // OK, we got a *reference* to some definition item. This may have been // a reference for some definition that we haven't created any declaration // entries for (i.e. because it had DisplayIfNoReferences = false). Because // we've now found a reference, we want to make sure all its declaration // entries are added. await AddDeclarationEntriesAsync(definition).ConfigureAwait(false); // First find the bucket corresponding to our definition. var definitionBucket = GetOrCreateDefinitionBucket(definition); var entry = await createEntryAsync(definitionBucket).ConfigureAwait(false); if (entry == null) { return; } lock (Gate) { // Once we can make the new entry, add it to the appropriate list. if (addToEntriesWhenGroupingByDefinition) { EntriesWhenGroupingByDefinition = EntriesWhenGroupingByDefinition.Add(entry); } if (addToEntriesWhenNotGroupingByDefinition) { EntriesWhenNotGroupingByDefinition = EntriesWhenNotGroupingByDefinition.Add(entry); } CurrentVersionNumber++; } // Let all our subscriptions know that we've updated. NotifyChange(); }