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

Add support for async lightbulb model. #53117

Merged
merged 68 commits into from
Jun 29, 2021

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented May 3, 2021

Examples of this in action:


Note: the delays are exaggerated here to see the impact.

@@ -392,6 +398,9 @@ private bool TryGetWorkspaceFixersPriorityMap(Document document, [NotNullWhen(tr
{
cancellationToken.ThrowIfCancellationRequested();

if (highPriority != null && highPriority != fixer.IsHighPriority)
continue;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code fixing, refactoring, and analyzers all effectively have a way to say: if you want high-pri or normal-pri, i'll limit to that set.

Copy link
Contributor

@mavasani mavasani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this looks great and matches the implementation I had in mind. Just moving the filtering a bit further down should make the behavior common across all IDE document diagnostic computation code paths.

@@ -117,6 +118,7 @@ public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
}
}

public CodeActionRequestPriority RequestPriority => CodeActionRequestPriority.Normal;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not to get into a bikeshedding argument here, but whats the thinking around whether there are high or normal? For example "Remove unused usings" only triggers from one spot in a document so would seem to me to be a decent candidate for high priority.

Perhaps its worth documenting some guidelines on the enum (if they're not already there.. haven't got that far yet)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effectively, everything that previously produced a 'high pri code action' is in the 'high pri request' category. Anything that produces a normal/low pri code action is in the normal request category. I didn't want to change anything in that regard here. Right now we've had a long historical precedent of recognizing two code actions (one analzyer, one refactoring) that are so important that they should beat out everything else. This PR codifies things so that not only do those come first, they are computed first so we can display them asap for the user.

ISuggestedActionCategorySet requestedActionCategories,
Document document,
SnapshotSpan range,
Func<string, IDisposable?> addOperationScope,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed? It's always _ => null?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure!

@CyrusNajmabadi CyrusNajmabadi merged commit 0d317a4 into dotnet:main-vs-deps Jun 29, 2021
@ghost ghost added this to the Next milestone Jun 29, 2021
@RikkiGibson RikkiGibson modified the milestones: Next, 17.0.P2 Jun 29, 2021
CyrusNajmabadi added a commit to CyrusNajmabadi/roslyn that referenced this pull request Jul 12, 2021
…tbulb"

This reverts commit 0d317a4, reversing
changes made to 5336a84.
JoeRobich added a commit that referenced this pull request Jul 12, 2021
Revert "Merge pull request #53117 from CyrusNajmabadi/asyncLightbulb"
@CyrusNajmabadi CyrusNajmabadi deleted the asyncLightbulb branch September 30, 2021 18:02
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.

9 participants