-
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
Perform nav bar computation in two passes #73786
Conversation
_ = _nonFrozenComputationCancellationSeries.CreateNext(); | ||
_computeModelQueue.AddWork( | ||
new NavigationBarQueueItem(FrozenPartialSemantics: true, NonFrozenComputationToken: null), | ||
cancelExistingWork: true); |
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.
mirrors what we do in tagging.
// to do the slow-but-accurate pass. | ||
var frozenPartialSemantics = queueItems.Any(t => t.FrozenPartialSemantics); | ||
|
||
if (!frozenPartialSemantics) |
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.
mirrors the same logic in tagging.
src/EditorFeatures/Core/NavigationBar/NavigationBarController_ModelComputation.cs
Outdated
Show resolved
Hide resolved
…ModelComputation.cs
/// computing skeletons, SG docs, etc.), do the next cheap frozen-nav-bar-pass, and then push the | ||
/// expensive-nonfrozen-nav-bar-pass to the end again. | ||
/// </summary> | ||
private readonly CancellationSeries _nonFrozenComputationCancellationSeries; |
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.
same pattern as tagging (including nameing).
@jasonmalinowski @sharwell @ToddGrun ptal. This impacts a large partner. |
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 feels like there should be an easier way to do this. If a feature was added to the queue to just say "and run this once there are no batches left" it might be easier? I think? Either way since this pattern is established, no reason to try to delay this here.
src/EditorFeatures/Core/NavigationBar/NavigationBarController.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/NavigationBar/NavigationBarController.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/NavigationBar/NavigationBarController_ModelComputation.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Jason Malinowski <[email protected]>
I'm waiting for the 3rd feature to need this. At that point, i'll wrap up in a helper (or make part of the queue itself :)). |
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2065682
This follows the same change made in taggers back in #72878.
The idea is fairly simple. When computing nav bar items, we always first try a simple and quick pass using frozen-partial semantics. This allows the nav bars to be reasonably up to date with whatever the user jsut types, as well as with the last contents of SG documents and skeleton references.
As long as new changes are coming in, we keep performing those cheap computation passes.
When a cheap computation pass finishes, we then enqueue a request to do one final expensive pass that will actually update hte navbars with non-frozen data. Thus, ensuring that we always finally get into a final, correct, state. That expensive pass will be pre-empted by more cheap requests that come in. But we'll always eventually run that expensive/correct pass as the final thing we do.