-
Notifications
You must be signed in to change notification settings - Fork 3.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
Restore unsaved buffers on restart #13546
Conversation
4d9b124
to
3404073
Compare
Co-authored-by: Bennet <bennet@zed.dev>
Co-authored-by: Antonio <antonio@zed.dev>
24452d2
to
2e5f45a
Compare
I have installed Zed 0.163.3 67d405d, which seems quite recent. |
@mvp do you see any errors in your zed log? I've seen the sqlite database we use get corrupted occasionally |
@mvp If I understand the current state -- and just in case you missed this -- it only works if you launch zed by opening a folder (not a file), and subsequently launch it by opening the very same folder. It's not yet implemented completely, only for "projects." |
I cannot find any sqlite db under ~/.config/zed. Is there any other place? Not supporting this transparently is very unfortunate. I guess back to Sublime Text :-( |
On MacOS the workspace is under ~/Library/Application Support/Zed |
Opening a directory and then adding unsaved file works as expected, and it preserves last opened directory upon restart, as well does not ask to save unsaved files upon exit. However, opening random files or scratches does not keep unsaved files, and does not remember list of previously opened files upon restart... |
Yeah, that's a current limitation. See this note above in the release notes:
|
For completeness, the current tracking issue is: |
This adds the ability for Zed to restore unsaved buffers on restart. The user is no longer prompted to save/discard/cancel when trying to close a Zed window with dirty buffers in it. Instead those dirty buffers are stored and restored on restart.
It does this by saving the contents of dirty buffers to the internal SQLite database in which Zed stores other data too. On restart, if there are dirty buffers in the database, they are restored.
On certain events (buffer changed, file saved, ...) Zed will serialize these buffers, throttled to a 100ms, so that we don't overload the machine by saving on every keystroke. When Zed quits, it waits until all the buffers are serialized.
Current limitations
cmd-shift-n
and type something in a buffer, this will not be stored and you will be asked whether to save/discard on quit. In the future, we want to fix this by also restoring windows without projects/worktrees.Demo
demo_unsaved_buffers.mp4
Related tickets
I'm unsure about closing them, without also fixing the 2nd limitation: restoring of worktree-less windows. So let's wait until that.
Note on performance
Release Notes:
{"session": {"restore_unsaved_buffers": false}}
.