From 0169bddb592e3563f8b36f0f8fddf997ad9cf062 Mon Sep 17 00:00:00 2001 From: maan2003 <49202620+maan2003@users.noreply.github.com> Date: Fri, 8 Aug 2025 10:32:11 +0530 Subject: [PATCH] project panel: Add setting to disable auto opening project panel (#34752) Release Notes: - Add `project_panel.starts_open` to control opening project panel in new projects. --- assets/settings/default.json | 2 ++ crates/project_panel/src/project_panel.rs | 4 ++++ crates/project_panel/src/project_panel_settings.rs | 5 +++++ docs/src/configuring-zed.md | 3 ++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/assets/settings/default.json b/assets/settings/default.json index d69fd58009..295bebe23a 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -596,6 +596,8 @@ // when a corresponding project entry becomes active. // Gitignored entries are never auto revealed. "auto_reveal_entries": true, + // Whether the project panel should open on startup. + "starts_open": true, // Whether to fold directories automatically and show compact folders // (e.g. "a/b/c" ) when a directory has only one subdirectory inside. "auto_fold_dirs": true, diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 45581a97c4..94d543ed0c 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -5625,6 +5625,10 @@ impl Panel for ProjectPanel { } fn starts_open(&self, _: &Window, cx: &App) -> bool { + if !ProjectPanelSettings::get_global(cx).starts_open { + return false; + } + let project = &self.project.read(cx); project.visible_worktrees(cx).any(|tree| { tree.read(cx) diff --git a/crates/project_panel/src/project_panel_settings.rs b/crates/project_panel/src/project_panel_settings.rs index 9057480972..8a243589ed 100644 --- a/crates/project_panel/src/project_panel_settings.rs +++ b/crates/project_panel/src/project_panel_settings.rs @@ -43,6 +43,7 @@ pub struct ProjectPanelSettings { pub sticky_scroll: bool, pub auto_reveal_entries: bool, pub auto_fold_dirs: bool, + pub starts_open: bool, pub scrollbar: ScrollbarSettings, pub show_diagnostics: ShowDiagnostics, pub hide_root: bool, @@ -139,6 +140,10 @@ pub struct ProjectPanelSettingsContent { /// /// Default: true pub auto_fold_dirs: Option, + /// Whether the project panel should open on startup. + /// + /// Default: true + pub starts_open: Option, /// Scrollbar-related settings pub scrollbar: Option, /// Which files containing diagnostic errors/warnings to mark in the project panel. diff --git a/docs/src/configuring-zed.md b/docs/src/configuring-zed.md index d2ca0e0604..67f1cd000b 100644 --- a/docs/src/configuring-zed.md +++ b/docs/src/configuring-zed.md @@ -3213,7 +3213,8 @@ Run the `theme selector: toggle` action in the command palette to see a current "indent_guides": { "show": "always" }, - "hide_root": false + "hide_root": false, + "starts_open": true } } ```