workspace: Support hot-exit for empty workspaces and single files#46557
workspace: Support hot-exit for empty workspaces and single files#46557SomeoneToIgnore merged 8 commits intozed-industries:mainfrom
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @shfc on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
Enables restoration of empty workspaces (without folders) that contain unsaved items like drafts or single files. Empty workspaces are now identified by workspace_id rather than paths, allowing multiple empty workspaces to coexist and be properly restored on startup.
8c956ad to
3e18648
Compare
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
Thank you for the attempt: it's amazing to see that now all the files I've edited in empty workspaces come back.
Yet, no unsaved changes are restored according to my testing:
no_changes.mov
I have merged main in to re-trigger the CI and fix the merge commits, but not sure how to help and fix the logic.
Do you have any clues?
Thanks for letting me know. I've resolved the data loss when working without a worktree by adding logic to restore the missing content to the test.mp4 |
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
Works like a charm now, amazing.
Thank you for finding a way to adjust the code, let's make it a bit more easy to approach for future changes and merge.
Updated. Thanks for your suggestions, please let me know what you think now. |
|
@SomeoneToIgnore fixed the formatting issue, please run the CI again |
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
Great change, thank you a lot!
|
Does this new functionality mean I can have Zed save non-persisted files (e.g. newly created, and not existing edited) without even having a workspace = akin to default on VSCode? |
|
This is a huge update! Just now, I wished Zed would re-open unsaved files, as I had lost a document I was working on last month that wasn’t yet saved. Before scanning the release notes, I tested an unsaved file, hoping I had missed something and that the feature might have been added. To my surprise, I found out it’s actually here! I was blown away by this news. Thank you, Zed and the community, for continuing to make this editor amazing. |
If you mean unsaved files not in a workspace, the answer is yes. I just tested it. My prayers have been answered. |
How can you get it to work? I currently have it set to Restore On Startup: Last Session, but when I create new files and close the Zed editor, it prompts to save the files or discard them all. |
I don’t know as I have never messed with my configs, besides the setting you said you have on, there are all enabled in my Zed: When Closing With No Tabs = Platform Default |
|
It is probably not fully fixed yet. As #48255 demonstrates. |
Did you use the version released after v0.222.0-pre? This feature hasn't been released on the current stable version yet. |
Thank you, you're absolutely right, my bad. I was expecting it to be the part of stable release already. Now I see that it was merged only in the preview release. |
|
It works great now in stable, thank you again for the work. But when I had various non-saved files opened which were re-opening fine after closure, I noticed that when a new update was downloaded and I clicked on "Update Zed and restart", after restart of Zed those non-saved files were gone. |
|
I noticed too that it usually works well but there is at least one situation where the unsaved files get lost: The same is true for non-empty workspaces but in that case I can reopen the workspace and the unsaved work comes back. |
Hi, could you please create a new issue for this? Since this PR is already done, it'll be easier to track that way. |
|
I believe we have one now: #48468 and it is a nice one to fix. |
Enables restoration of empty workspaces (without folders) that contain unsaved items like drafts or single files. Empty workspaces are now identified by workspace_id rather than paths, allowing multiple empty workspaces to coexist and be properly restored on startup. This ensures users don't lose work when closing Zed with unsaved files in empty workspaces.
Closes #15098
Release Notes: