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.

Improve visibility and wording around `close panel on toggle` setting (#63548)

Matei Oprea8ce383f22130
diff --git a/assets/settings/default.json b/assets/settings/default.json
index 78749a6be73..671653708dc 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 bcc6ba1523b..7aa8bc42a86 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<bool>,
- /// 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<bool>,
diff --git a/crates/settings_ui/src/page_data.rs b/crates/settings_ui/src/page_data.rs
index 9941e2c3fdd..5d3a5f7ce9f 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 2eb333f1eeb..35ae9bb8dd5 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.