-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify passing around of FAR symbol groups #74358
Conversation
{ | ||
cancellationToken.ThrowIfCancellationRequested(); | ||
|
||
using (Logger.LogBlock(FunctionId.FindReference_ProcessDocumentAsync, cancellationToken)) | ||
{ | ||
// This is safe to just blindly read. We can only ever get here after the call to ReportGroupsAsync | ||
// happened. So there must be a group for this symbol in our map. | ||
var group = _symbolToGroup[symbol]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the crux of hte change is that instead of having a collection be blindly written and read from from disparate locations, we just take t6he point that we write the data initially and pass that data along all the way to here so we're never out of sync.
.../Portable/FindSymbols/FindReferences/FindReferencesSearchEngine_FindReferencesInDocuments.cs
Outdated
Show resolved
Hide resolved
.../Portable/FindSymbols/FindReferences/FindReferencesSearchEngine_FindReferencesInDocuments.cs
Outdated
Show resolved
Hide resolved
…ferencesSearchEngine_FindReferencesInDocuments.cs
/// </summary> | ||
private readonly ConcurrentDictionary<ISymbol, SymbolGroup> _symbolToGroup = new(MetadataUnifyingEquivalenceComparer.Instance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed this from being ambient state to just being a normal scratch buffer created within the Far algorithm (like all the other maps/sets/lists it has.
foreach (var symbol in symbols) | ||
await ReportGroupAsync(symbol, cancellationToken).ConfigureAwait(false); | ||
result.Add((symbol, await ReportGroupSeriallyAsync(symbol, symbolToGroup, cancellationToken).ConfigureAwait(false))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we ensure that the symbol and its group always travel together.
…ferencesSearchEngine_FindReferencesInDocuments.cs
@dibarbet ptal. |
} | ||
private static readonly ObjectPool<Dictionary<ISymbol, SymbolGroup>> s_symbolToGroupPool = new(() => new(MetadataUnifyingEquivalenceComparer.Instance)); | ||
|
||
private readonly Solution _solution = solution; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do these need to be reassigned?
Fixes #70850
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2135708