-
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
Add support for async lightbulb model. #53117
Add support for async lightbulb model. #53117
Conversation
src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionsSource.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionsSource.cs
Outdated
Show resolved
Hide resolved
@@ -392,6 +398,9 @@ private bool TryGetWorkspaceFixersPriorityMap(Document document, [NotNullWhen(tr | |||
{ | |||
cancellationToken.ThrowIfCancellationRequested(); | |||
|
|||
if (highPriority != null && highPriority != fixer.IsHighPriority) | |||
continue; |
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.
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.
...es/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs
Show resolved
Hide resolved
...es/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs
Show resolved
Hide resolved
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.
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.
59c0c2a
to
b4834c9
Compare
...orFeatures/Core.Wpf/Suggestions/SuggestedActionSource_ISuggestedActionsSourceExperimental.cs
Outdated
Show resolved
Hide resolved
@@ -117,6 +118,7 @@ public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics | |||
} | |||
} | |||
|
|||
public CodeActionRequestPriority RequestPriority => CodeActionRequestPriority.Normal; |
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.
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)
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.
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.
...orFeatures/Core.Wpf/Suggestions/SuggestedActionSource_ISuggestedActionsSourceExperimental.cs
Outdated
Show resolved
Hide resolved
...orFeatures/Core.Wpf/Suggestions/SuggestedActionSource_ISuggestedActionsSourceExperimental.cs
Outdated
Show resolved
Hide resolved
ISuggestedActionCategorySet requestedActionCategories, | ||
Document document, | ||
SnapshotSpan range, | ||
Func<string, IDisposable?> addOperationScope, |
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.
Can be removed? It's always _ => null
?
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.
sure!
...orFeatures/Core.Wpf/Suggestions/SuggestedActionSource_ISuggestedActionsSourceExperimental.cs
Outdated
Show resolved
Hide resolved
Revert "Merge pull request #53117 from CyrusNajmabadi/asyncLightbulb"
Examples of this in action:
Note: the delays are exaggerated here to see the impact.