Skip to content

Conversation

@CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented Oct 15, 2021

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

@CyrusNajmabadi CyrusNajmabadi requested review from a team as code owners October 15, 2021 03:09
@ghost ghost added the Area-IDE label Oct 15, 2021
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);
Copy link
Member Author

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

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

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.

@CyrusNajmabadi
Copy link
Member Author

Closing in favor of #57171

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant