From 04fc4edf86136254c2f9b3a40be9628ef5a8350f Mon Sep 17 00:00:00 2001 From: Matei Oprea Date: Tue, 1 Sep 2026 15:53:33 +0000 Subject: [PATCH] Improve visibility and wording around `close panel on toggle` setting (#63548) # Objective - Improve documentation for `close_panel_on_toggle` setting. ## Solution - Previous docs were a bit ambiguous and since refactoring the setting name is not possible at the time, I improved the documentation. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [ ] Tests cover the new/changed behavior - [ ] Performance impact has been considered and is acceptable Release Notes: - Added the`close_panel_on_toggle` setting to the settings UI and improved its documentation. --- assets/settings/default.json | 7 ++++--- crates/settings_content/src/workspace.rs | 7 ++++--- crates/settings_ui/src/page_data.rs | 18 +++++++++++++++++- docs/src/reference/all-settings.md | 10 ++++++++++ 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/assets/settings/default.json b/assets/settings/default.json index 78749a6be7..671653708d 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -192,9 +192,10 @@ "reveal_if_open": false, // Whether to automatically close files that have been deleted on disk. "close_on_file_delete": false, - // Whether toggling a panel (e.g. with its keyboard shortcut) also closes - // the panel when it is already focused, instead of just moving focus back - // to the editor. + // Whether invoking a panel's ToggleFocus action while the panel is already + // focused closes the panel, instead of just moving focus back to the + // editor. This only applies to a panel's focus-toggle action, not to its + // regular visibility-toggle action. "close_panel_on_toggle": false, // Relative size of the drop target in the editor that will open dropped file as a split pane (0-0.5) // E.g. 0.25 == If you drop onto the top/bottom quarter of the pane a new vertical split will be used diff --git a/crates/settings_content/src/workspace.rs b/crates/settings_content/src/workspace.rs index bcc6ba1523..7aa8bc42a8 100644 --- a/crates/settings_content/src/workspace.rs +++ b/crates/settings_content/src/workspace.rs @@ -135,9 +135,10 @@ pub struct WorkspaceSettingsContent { /// /// Default: true pub zoomed_padding: Option, - /// Whether toggling a panel (e.g. with its keyboard shortcut) also closes - /// the panel when it is already focused, instead of just moving focus back - /// to the editor. + /// Whether invoking a panel's `ToggleFocus` action while the panel is + /// already focused closes the panel, instead of just moving focus back + /// to the editor. This only applies to a panel's focus-toggle action, not + /// to its regular visibility-toggle action. /// /// Default: false pub close_panel_on_toggle: Option, diff --git a/crates/settings_ui/src/page_data.rs b/crates/settings_ui/src/page_data.rs index 9941e2c3fd..5d3a5f7ce9 100644 --- a/crates/settings_ui/src/page_data.rs +++ b/crates/settings_ui/src/page_data.rs @@ -5042,7 +5042,7 @@ fn window_and_layout_page() -> SettingsPage { ] } - fn pane_modifiers_section() -> [SettingsPageItem; 4] { + fn pane_modifiers_section() -> [SettingsPageItem; 5] { [ SettingsPageItem::SectionHeader("Pane Modifiers"), SettingsPageItem::SettingItem(SettingItem { @@ -5109,6 +5109,22 @@ fn window_and_layout_page() -> SettingsPage { metadata: None, files: USER, }), + SettingsPageItem::SettingItem(SettingItem { + title: "Close Panel on Toggle", + description: "Whether invoking a panel's ToggleFocus action while it's already focused closes the panel, instead of just moving focus back to the editor.", + field: Box::new(SettingField { + organization_override: None, + json_path: Some("close_panel_on_toggle"), + pick: |settings_content| { + settings_content.workspace.close_panel_on_toggle.as_ref() + }, + write: |settings_content, value, _| { + settings_content.workspace.close_panel_on_toggle = value; + }, + }), + metadata: None, + files: USER, + }), ] } diff --git a/docs/src/reference/all-settings.md b/docs/src/reference/all-settings.md index 2eb333f1ee..35ae9bb8dd 100644 --- a/docs/src/reference/all-settings.md +++ b/docs/src/reference/all-settings.md @@ -502,6 +502,16 @@ When enabled, this setting will automatically close tabs for files that have bee > Note: Dirty files (files with unsaved changes) will not be automatically closed even when this setting is enabled, ensuring you don't lose unsaved work. +## Close Panel on Toggle + +- Description: Whether invoking a panel's `ToggleFocus` action while the panel is already focused closes the panel, instead of just moving focus back to the editor. This only applies to a panel's focus-toggle action, not to its regular visibility-toggle action. +- Setting: `close_panel_on_toggle` +- Default: `false` + +**Options** + +`boolean` values + ## Code Lens - Description: Whether and how to display code lenses from language servers. Code lenses show contextual information such as reference counts, implementations, and other metadata provided by the language server.