zed: Add ability to restore last session w/ multiple windows (#14965)

This adds the ability for Zed to restore multiple windows after
restarting. It's now the default behavior.

Release Notes:

- Added ability to restore all windows that were open when Zed was quit.
Previously only the last used workspace was restored. This is now the
default behavior. To get back the old behavior, add the following to
your settings: `{"restore_on_startup": "last_workspace"}` (Part of
[#4985](https://github.com/zed-industries/zed/issues/4985) and
[#4683](https://github.com/zed-industries/zed/issues/4683))

Demo:



https://github.com/user-attachments/assets/57a375ec-0c6a-4724-97c4-3fea8f18bc2d

---------

Co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
Thorsten Ball 2024-07-23 19:44:02 +02:00 committed by GitHub
parent 53f828df7d
commit 17ef9a367f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 660 additions and 172 deletions

View file

@ -47,8 +47,10 @@ pub enum RestoreOnStartupBehaviour {
/// Always start with an empty editor
None,
/// Restore the workspace that was closed last.
#[default]
LastWorkspace,
/// Restore all workspaces that were open when quitting Zed.
#[default]
LastSession,
}
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema)]
@ -74,8 +76,8 @@ pub struct WorkspaceSettingsContent {
/// Default: off
pub autosave: Option<AutosaveSetting>,
/// Controls previous session restoration in freshly launched Zed instance.
/// Values: none, last_workspace
/// Default: last_workspace
/// Values: none, last_workspace, last_session
/// Default: last_session
pub restore_on_startup: Option<RestoreOnStartupBehaviour>,
/// The size of the workspace split drop targets on the outer edges.
/// Given as a fraction that will be multiplied by the smaller dimension of the workspace.