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

VSCode CustomEditor - SaveAs command cannot be executed #14966

Open
VadimGroGit opened this issue Feb 18, 2025 · 2 comments · May be fixed by #14972
Open

VSCode CustomEditor - SaveAs command cannot be executed #14966

VadimGroGit opened this issue Feb 18, 2025 · 2 comments · May be fixed by #14972
Labels
bug bugs found in the application custom-editor issues related to custom-editor functionality

Comments

@VadimGroGit
Copy link

Bug Description:

Standard MS sample for Custom Editor API
https://github.com/microsoft/vscode-extension-samples/tree/main/custom-editor-sample

For both editors ( CustomTextEditor, CustomEditor ) , the SAVE_AS command doesn’t work when
running in Theia (neither when called from the menu, nor by Ctrl-Shift-S).
The SAVE command works absolutely correctly.

In VS code, both commands work fine.

Steps to Reproduce:

  1. Build sample : https://github.com/microsoft/vscode-extension-samples/tree/main/custom-editor-sample
  2. Theia -> install from .VSIX
  3. open any plugin exampleFiles ( .catScratch or .pawDraw )
  4. try to SaveAs ( it doesn't matter with or without editing )

Additional Information

As far as I could figure out, the reason is here :

the MS sample implements methods from the interface CustomEditorProvider

saveCustomDocument(..)
saveCustomDocumentAs(..)

But in Theia, in FilesystemSaveableService does not use the method saveCustomDocumentAs(..).
Instead, when executing the SAVE_AS command, calls to the

widget.saveable.createSnapshot or
widget.saveable.serialize

methods are used.

See the implementation of the methods

FilesystemSaveableService : canSaveAs(..)
FilesystemSaveableService : saveSnapshot(..)

Thus, the method saveCustomDocumentAs(..), which is implemented in
class PawDrawEditorProvider implements vscode.CustomEditorProvider<..>,
is never called.

  • Operating System: Windows 10, Fedora 41
  • Theia Version: 1.58.100, 1.57.100
@msujew msujew added bug bugs found in the application custom-editor issues related to custom-editor functionality labels Feb 18, 2025
@msujew msujew linked a pull request Feb 18, 2025 that will close this issue
1 task
@msujew
Copy link
Member

msujew commented Feb 18, 2025

I've filed #14972 to fix this.

@VadimGroGit
Copy link
Author

Thanks, Mark.
It looks promising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application custom-editor issues related to custom-editor functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants