-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
custom-editor: restore editor as part of layout #10787
Comments
Hi, |
@safisa I haven't worked on the issue, if you are interested please don't hesitate on contributing a fix. You'll need to debug as to why the Some interesting places to look: theia/packages/plugin-ext/src/main/browser/custom-editors/custom-editor-widget.ts Lines 86 to 97 in 4326029
theia/packages/plugin-ext/src/main/browser/custom-editors/plugin-custom-editor-registry.ts Lines 56 to 72 in 4326029
The layout is stored in the |
To resolve this issue, we need to registerWebviewPanelSerializer in the vscode extension code. This was missing in my implementation, once I did it (in the following example) the custom editor layout was restored on reload. BUT there was a small issue on restore, getting undefined error in Theia CustomEditorWidget class, the _modelRef is undefined (we got there from a call to the setLayoutData in the application shell):
Once overriding this in my Theia extension:
An example of a registerWebviewPanelSerializer in the vscode extension code:
I will open a PR to fix the saveable issue in the CustomEditorWidget class. |
Just a note that I'm working on a fix. |
@pisv Just a quick FYI: We had a similar issue while implementing the notebook support for Theia. We introduced the |
@msujew Sure, my fix is actually based on using the |
If there are no objections, the fix will be submitted as a separate commit in a bigger PR for #9079, which will also fix a number of other issues; I'm currently working on saving/restoring state of side-by-side editors containing |
@pisv I think that's perfectly fine, just make sure to include testing steps for all the things you have fixed :) |
Fixes an incorrect assumption that a custom editor cannot be restored if no `WebviewPanelSerializer` is registered for its view type. (Actually, custom editors are created and restored using a custom editor provider.) Also, ensures that `CustomEditorWidget.modelRef` satisfies the shape for the `CustomEditorWidget` defined in `editor.ts` and cannot return `undefined`. (However, `CustomEditorWidget.modelRef.object` can be `undefined` until the custom editor is resolved.) Fixes eclipse-theia#10787
Fixes an incorrect assumption that a custom editor cannot be restored if no `WebviewPanelSerializer` is registered for its view type. (Actually, custom editors are created and restored using a custom editor provider.) Also, ensures that `CustomEditorWidget.modelRef` satisfies the shape for the `CustomEditorWidget` defined in `editor.ts` and cannot return `undefined`. (However, `CustomEditorWidget.modelRef.object` can be `undefined` until the custom editor is resolved.) Fixes eclipse-theia#10787
I have submitted PR #13916, which contains a fix for this issue. |
Fixes an incorrect assumption that a custom editor cannot be restored if no `WebviewPanelSerializer` is registered for its view type. (Actually, custom editors are created and restored using a custom editor provider.) Also, ensures that `CustomEditorWidget.modelRef` satisfies the shape for the `CustomEditorWidget` defined in `editor.ts` and cannot return `undefined`. (However, `CustomEditorWidget.modelRef.object` can be `undefined` until the custom editor is resolved.) Fixes eclipse-theia#10787
Fixes an incorrect assumption that a custom editor cannot be restored if no `WebviewPanelSerializer` is registered for its view type. (Actually, custom editors are created and restored using a custom editor provider.) Also, ensures that `CustomEditorWidget.modelRef` satisfies the shape for the `CustomEditorWidget` defined in `editor.ts` and cannot return `undefined`. (However, `CustomEditorWidget.modelRef.object` can be `undefined` until the custom editor is resolved.) Fixes eclipse-theia#10787
* Fix loading of webview resources that depend on query params Some resource url (notably git) use the query part of the url to store additional information. The query part of the url was incorrectly being dropped while attempting to load these resources inside of webviews. See also microsoft/vscode@48387df * Fix `Error: Unknown Webview` messages in the log * Fix design and implementation issues surrounding `CustomEditorOpener` This commit ensures that the promise returned by `CustomEditorOpener.open` will only resolve to a properly initialized and opened `CustomEditorWidget`. In particular, it ensures that the widget is opened according to the specified `WidgetOpenerOptions`, including `widgetOptions.ref` and `mode`. Essentially, it revises the work done in #9671 and #10580 to fix #9670 and #10583. * Restore custom editors as part of layout Fixes an incorrect assumption that a custom editor cannot be restored if no `WebviewPanelSerializer` is registered for its view type. (Actually, custom editors are created and restored using a custom editor provider.) Also, ensures that `CustomEditorWidget.modelRef` satisfies the shape for the `CustomEditorWidget` defined in `editor.ts` and cannot return `undefined`. (However, `CustomEditorWidget.modelRef.object` can be `undefined` until the custom editor is resolved.) Fixes #10787 * Fix a race condition when file system provider is activated When file system provider is activated, wait until it is registered. * git: add support for custom editors * Uses `OpenerService` instead of `EditorManager` to open editors * Contributes a `FileSystemProvider` for git-resources * Fixes an issue with getting blob contents * custom editor: open a diff-uri in a side-by-side editor `CustomEditorOpener` is now able to open a diff-uri in a side-by-side editor, which contains the corresponding `CustomEditor`s. Fixes #9079
Bug Description:
The framework currently does not support restoring
custom-editors
as part of the layout. If a given custom-editor is opened and the application is restarted (reload the window for example) the editor will not be preserved.custom-editor-bug.mp4
Steps to Reproduce:
example.cscratch
- the custom editor should open.The text was updated successfully, but these errors were encountered: