Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fall back to empty workspace when devcontainer restore is cancelled (#54734)

Max Malkine2b02e22900f
diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs
index 234179f9a53..9141fe1aa8a 100644
--- a/crates/zed/src/main.rs
+++ b/crates/zed/src/main.rs
@@ -1469,6 +1469,31 @@ pub(crate) async fn restore_or_create_workspace(
.await?;
}
}
+
+ // If the user cancelled a failed remote connection at startup,
+ // open_remote_project returns Ok but removes the window, so error_count
+ // stays 0 and the toast fallback above does not trigger. Without this
+ // check, Zed would exit silently.
+ if cx.update(|cx| cx.windows().is_empty()) {
+ cx.update(|cx| {
+ workspace::open_new(
+ Default::default(),
+ app_state.clone(),
+ cx,
+ |workspace, window, cx| {
+ let restore_on_startup =
+ WorkspaceSettings::get_global(cx).restore_on_startup;
+ match restore_on_startup {
+ workspace::RestoreOnStartupBehavior::Launchpad => {}
+ _ => {
+ Editor::new_file(workspace, &Default::default(), window, cx);
+ }
+ }
+ },
+ )
+ })
+ .await?;
+ }
} else if matches!(kvp.read_kvp(FIRST_OPEN), Ok(None)) {
cx.update(|cx| show_onboarding_view(app_state, cx)).await?;
} else {