Ensure notebook document event registration #14242
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What it does
Ok, this one is a bit difficult to describe, but I will try my best:
The Jupyter plugin uses a context key called
jupyter.ispythonnotebook
to determine whether to show thejupyter.openVariableView
button.This context key is set inside of the jupyter plugin, after encountering the
metadata.kernelSpec
property. This metadata property is set immediately when the notebook opens. This is done by performing a notebook metadata edit. This edit is performed correctly in the frontend notebook model, but since the necessary events aren't setup yet, the metadata edit isn't propagated back to the plugin host.This change adjusts the order in which the service calls are happening to ensure that all events are properly setup before the notebook opening event is sent to the plugin host. This ensures that any edit operation on the frontend side is correctly propagated towards the plugin host.
How to test
Open a notebook editor for a
.ipynb
file and select a kernel. Reload the app and ensure that theVariables
button is available in the notebook toolbar.Review checklist
Reminder for reviewers