From 538298378a352b4c911f9c61b2435e4fb6816130 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Mon, 4 Mar 2024 17:42:30 +0800 Subject: [PATCH] Return "open in new window" as default in recent projects (#8798) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/zed-industries/zed/assets/5518/8bbd13a7-9144-48b0-9bc8-6651725476f8 Closes https://github.com/zed-industries/zed/issues/8651 Reworks `recent_projects::OpenRecent` action with collab projects in mind: * keep the "open in new window" behavior for corresponding menu and command entries * use new, "reuse current window" behavior in the recent projects picker up in the toolbar This way, old Zed behavior is not customizable, kept as original in all main use cases — so that projects shared via remote entities: a channel and a call, are never accidentally closed, breaking the sharing. Release Notes: - Return "open in new window" as default in recent projects --- crates/recent_projects/src/recent_projects.rs | 14 +++++++------- crates/zed/src/app_menus.rs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/recent_projects/src/recent_projects.rs b/crates/recent_projects/src/recent_projects.rs index 14a8ae7e9c..f2d0ad0f84 100644 --- a/crates/recent_projects/src/recent_projects.rs +++ b/crates/recent_projects/src/recent_projects.rs @@ -16,10 +16,14 @@ use workspace::{ModalView, Workspace, WorkspaceId, WorkspaceLocation, WORKSPACE_ #[derive(PartialEq, Clone, Deserialize, Default)] pub struct OpenRecent { - #[serde(default)] + #[serde(default = "default_create_new_window")] pub create_new_window: bool, } +fn default_create_new_window() -> bool { + true +} + gpui::impl_actions!(projects, [OpenRecent]); pub fn init(cx: &mut AppContext) { @@ -269,7 +273,7 @@ impl PickerDelegate for RecentProjectsDelegate { workspace .update(&mut cx, |workspace, cx| { workspace.open_workspace_for_paths( - replace_current_window, + true, candidate_paths, cx, ) @@ -280,11 +284,7 @@ impl PickerDelegate for RecentProjectsDelegate { } }) } else { - workspace.open_workspace_for_paths( - replace_current_window, - candidate_paths, - cx, - ) + workspace.open_workspace_for_paths(false, candidate_paths, cx) } } else { Task::ready(Ok(())) diff --git a/crates/zed/src/app_menus.rs b/crates/zed/src/app_menus.rs index 43b1d45c15..12a88ed216 100644 --- a/crates/zed/src/app_menus.rs +++ b/crates/zed/src/app_menus.rs @@ -40,7 +40,7 @@ pub fn app_menus() -> Vec> { MenuItem::action( "Open Recent...", recent_projects::OpenRecent { - create_new_window: false, + create_new_window: true, }, ), MenuItem::separator(),