From 95118c6568687987882f208c1dd991bfa7270a26 Mon Sep 17 00:00:00 2001 From: William Viktorsson Date: Mon, 29 Apr 2024 17:56:23 +0200 Subject: [PATCH] Restore previous workspace on application resume (#10813) Addresses #10812 Release Notes: - Launching an empty already-running Zed application now behaves like a regular startup and respects the user `resume_on_startup` setting. ([#10812](https://github.com/zed-industries/zed/issues/10812)). See attached showcase which highlights how the previous project can now be re-opened through both "quit" and "close window". This has a noticeable performance benefit on startup/project resume time. This should also make the behaviour of closing/opening an application consistent between macOS/Linux/Windows. https://github.com/zed-industries/zed/assets/22855292/9c37ba31-ce0a-4c3d-940d-a56e3347e64a --- crates/zed/src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 97b0526bbc..de8c95dbf5 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -227,8 +227,9 @@ fn init_ui(args: Args) { app.on_reopen(move |cx| { if let Some(app_state) = AppState::try_global(cx).and_then(|app_state| app_state.upgrade()) { - workspace::open_new(app_state, cx, |workspace, cx| { - Editor::new_file(workspace, &Default::default(), cx) + cx.spawn({ + let app_state = app_state.clone(); + |cx| async move { restore_or_create_workspace(app_state, cx).await } }) .detach(); }