Skip to content
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

Merged
merged 10 commits into from
Jul 12, 2024

Conversation

CyrusNajmabadi
Copy link
Member

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 11, 2024
{
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];
Copy link
Member Author

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.

…ferencesSearchEngine_FindReferencesInDocuments.cs
/// </summary>
private readonly ConcurrentDictionary<ISymbol, SymbolGroup> _symbolToGroup = new(MetadataUnifyingEquivalenceComparer.Instance);
Copy link
Member Author

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)));
Copy link
Member Author

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
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review July 11, 2024 18:51
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner July 11, 2024 18:51
@CyrusNajmabadi
Copy link
Member Author

@dibarbet ptal.

}
private static readonly ObjectPool<Dictionary<ISymbol, SymbolGroup>> s_symbolToGroupPool = new(() => new(MetadataUnifyingEquivalenceComparer.Instance));

private readonly Solution _solution = solution;
Copy link
Member

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?

@CyrusNajmabadi CyrusNajmabadi merged commit b05da42 into dotnet:main Jul 12, 2024
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jul 12, 2024
@CyrusNajmabadi CyrusNajmabadi deleted the farGrups branch July 12, 2024 00:42
@RikkiGibson RikkiGibson modified the milestones: Next, 17.12 P1 Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KeyNotFoundException thrown from FindSymbols.FindReferencesSearchEngine.ProcessDocumentAsync
3 participants