-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add priority classes for add-import #57170
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
Add priority classes for add-import #57170
Conversation
| var fixesForDiagnostic = await addImportService.GetFixesForDiagnosticsAsync( | ||
| document, span, diagnostics, MaxResults, symbolSearchService, searchReferenceAssemblies, packageSources, cancellationToken).ConfigureAwait(false); | ||
| document, span, diagnostics, MaxResults, this.RequestPriority, | ||
| symbolSearchService, searchReferenceAssemblies, packageSources, 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.
this is the start of the change. we are passing RequestPriority along from teh fix provider all the way to the service that computes the fixes.
| protected abstract string GetDescription(IReadOnlyList<string> nameParts); | ||
| protected abstract (string description, bool hasExistingImport) GetDescription(Document document, OptionSet options, INamespaceOrTypeSymbol symbol, SemanticModel semanticModel, SyntaxNode root, CancellationToken cancellationToken); | ||
|
|
||
| public async Task<ImmutableArray<AddImportFixData>> GetFixesAsync( |
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.
most of the code is just passing the priority along.
| this, document, semanticModel, diagnosticId, node, symbolSearchService, | ||
| searchReferenceAssemblies, packageSources, cancellationToken); | ||
|
|
||
| // Look for exact matches first: |
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.
this is the meat of the change. here's where we look at waht priority our caller was at and we use that to decide what sorts of results we return.
|
Closing in favor of #57171 |
Fixes #57157
This is targetting 17.0 to address the async lightbulb regression there. The core issue here is that prior to 'async lightbulbs' 'add using' already had two priority classes. Normal 'exact match' fixes that would show up at the top of the lightbulb, and 'normal pri' 'fuzzy matching' fixes that would show up at the bottom.
When we switched to async lightbulbs this broke as we'd compute all add-using fixes and put them before everything else. The fix here is to make add-using have two entrypoints, one for high and one for normal pri fixes. This way we can have:
High pri add using fixes
Normal pri other fixes
Normal pri add using fixes