Repository navigation
make sure that we run our show code when a custom editor is shown #14022
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
Merged
Ian Huff (IanMatthewHuff)
merged 2 commits into
microsoft:main
from
IanMatthewHuff:dev/ianhu/customEditorAutoStart
Sep 22, 2020
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Have Custom Editors load on editor show unless autostart is disabled. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
In nativeEditorProviderOld show() is run on loadNotebookEditor. In the custom editor show is not run. Presumably due to the comment that I removed that it should already be visible. However the show() function of interactiveBase.ts is where we run createNotebookIfProviderConnectionExists. Since we didn't call show for the custom editor that code that creates the notebook never gets run and the notebook never auto starts regardless of the setting.
The design on show doing the notebook load seems a bit off in general, but adding in the show here seems the easiest and cleanest way to keep this symmetrical with the old editor, especially if we are considering a release port of this.
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.
I'm surprised this works? This looks very similar to the race condition we used to have here where we wait for show before resolving. That was the cause #13901
Could we instead just call show and not wait for it? That would make me more comfortable
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.
Or maybe have the createNotebookIfProviderConnectionExists in the constructor/load of the window instead?
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.
Yeah, this works in all scenarios when I tested the basic matrix of (Auto Load On / Off vs Old Editor / Custom Editor). I'm not seeing the race condition looking at the code, but I believe ya.
I might take a peek at putting it in constructor. Off hand it feels like it belongs more there anyways. But I feel like I recall moving it out into the show for a reason before. I'll try it and see how it looks.
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.
Rich Chiodo (@rchiodo) Moved it into the constructor and tested the same four scenarios. Looks good there. And we don't need it in the show at all anymore or to call the show from the native provider.