Skip to content
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

Notebook opens as text/plain after reload + click #99369

Closed
joaomoreno opened this issue Jun 4, 2020 · 5 comments
Closed

Notebook opens as text/plain after reload + click #99369

joaomoreno opened this issue Jun 4, 2020 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug custom-editors Custom editor API (webview based editors) notebook verified Verification succeeded
Milestone

Comments

@joaomoreno
Copy link
Member

  1. Open notebook
  2. Reload
  3. While it loads, click the notebook in the file explorer

🐛 Notebook opens as text/plain.

recording (16)

@rebornix
Copy link
Member

rebornix commented Jun 5, 2020

I can reproduce this issue with Image Editor too. The root cause is when we click the file from file explorer after reloading the workspace, the editoroverrides are not registered yet, which will then open the document in text editor.

@rebornix rebornix added bug Issue identified by VS Code Team member as probable bug custom-editors Custom editor API (webview based editors) notebook labels Jun 5, 2020
@rebornix rebornix added this to the June 2020 milestone Jun 5, 2020
@rebornix
Copy link
Member

Actually I was wrong, we registered editoroverrides very early on. The root cause is group view listeners are registered only when groups are all restored

this.editorGroupService.whenRestored.then(() => this.onEditorsRestored());

and only when the group view listeners are registered, editor overrides will be called

groupDisposables.add(group.onWillOpenEditor(event => {
this.onGroupWillOpenEditor(group, event);
}));

I'm wondering if we can register those event listeners a bit earlier, for example, register after the groups are created from EditorPart#doCreateGridControl https://github.com/microsoft/vscode/blob/master/src/vs/workbench/browser/parts/editor/editorPart.ts#L929, instead of waiting for the groups fully resolved. @bpasero @isidorn any suggestions?

@bpasero
Copy link
Member

bpasero commented Jun 26, 2020

@rebornix yes looks like the overrides need to register early, but the problem is that the groups only restore as part of the startup, so you cannot register listeners without knowing which groups are there.

I think again, this way of overrides is full of issues and #100281 discusses an alternative where you register an override statically that will kick in very early in the createInput of things. If you have energy to drive this change and adopt it for notebooks, please go ahead.

@rebornix
Copy link
Member

Moving this out of June and the polish should happen with #100281. Discussions and proposals will continue there.

@mjbvz
Copy link
Collaborator

mjbvz commented May 6, 2021

I believe this has been fixed by @lramos15's recent work. Assigning to May for verification

@mjbvz mjbvz closed this as completed May 6, 2021
@mjbvz mjbvz modified the milestones: On Deck, May 2021 May 6, 2021
@meganrogge meganrogge added the verified Verification succeeded label Jun 3, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jun 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug custom-editors Custom editor API (webview based editors) notebook verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants