-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
How to implement hot exit on a custom editor? #96484
Comments
In However your extension is responsible for restoring itself. Usually this just means reading the editor's initial content from the backup location instead of from the workspace Try using |
I didn't notice that PawDraw uses that, but backupId is not set when I go through a hotExit flow
Also, why is there an id instead of giving it the path? Are there cases where the backup will be saved in multiple documents and the suggested path will be ignored? |
Yes, the id is entirely up to the extension. I just used the path as the id for convenience. Other extensions may maintain their own mapping between id and their backup resources |
Got it, but it does seem to be broken in my testing and hot exit doesn't work in PawDraw |
Pushed fixed to VS Code and to the extension sample. Should be working now but let me know if you still see issues |
@mjbvz Sometimes, when I reopen VSCode having unsaved changes, the editor is not properly loaded. I managed to properly reopen the editor once I close VSCode with a text editor on focus. EDIT: One more thing for the scenario where I make some changes, save them and close VSCode. When I reopen VSCode, despite there are no changes, the Hope this helps. |
@caponetto Thanks for testing! Please try out the next VS Code insiders build with the extension sample from here: https://github.com/microsoft/vscode-extension-samples/tree/master/custom-editor-sample There were bugs with both VS Code implementation and with the extension sample |
Thanks, @mjbvz! These issues I've reported above are gone. |
Testing #96315
I wanted to implement hot exit, but I am confused about how to restore the backup. VS Code called
backupCustomDocument
and told the extension where to store the backup. How can the extension know where the backup is after a reload? Is it expected to save the location to storage somewhere? It seems like VS Code mainly manages backups so I expected that it would call a method to restore from the backup at location X.The text was updated successfully, but these errors were encountered: