-
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
Run providers in parallel when determining if we should show the lightbulb icon #73758
Conversation
src/Features/Core/Portable/CodeRefactorings/CodeRefactoringService.cs
Outdated
Show resolved
Hide resolved
// We want to pass linkedTokenSource.Token here so that we can cancel the inner operation once the | ||
// outer ProducerConsumer sees a single refactoring returned by any provider. | ||
var refactoring = await @this.GetRefactoringFromProviderAsync( | ||
document, state, provider, options, linkedTokenSource.Token).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.
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.
It should not be possible. we only dispose after the call to RunParallelAsync has completed. And it only completes Asher both the producer and consumer complete.
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.
took a minute to process, but yeah, that makes sense. Thanks!
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.
Right now when determining if the lightbulb shoudl appear, we run providers serially, ending up with a long serial chain of costs like so:
individually providers aren't that expensive. But when we have dozens to hundreds of them, this adds up.
This PR switches to running them in parallel, canceling either whne we are told to stop, or the moment we find one that has a refactoring.