diff --git a/assets/settings/default.json b/assets/settings/default.json index 8775d340b0..e9d201ab77 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -291,11 +291,6 @@ "autosave": "off", // Settings related to the editor's tab bar. "tab_bar": { - // Whether or not to show the navigation history buttons. - "show_nav_history_buttons": true - }, - // Settings related to the editor's tabs - "tabs": { // Where to show the tab bar in the editor. // This setting can take three values: // @@ -306,6 +301,11 @@ // 3. Don't show the tab bar: // "no" "placement": "top", + // Whether or not to show the navigation history buttons. + "show_nav_history_buttons": true + }, + // Settings related to the editor's tabs + "tabs": { // Show git status colors in the editor tabs. "git_status": false, // Position of the close button on the editor tabs. diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index e0eade74f3..4816d9554f 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -129,12 +129,9 @@ use ui::{ Tooltip, }; use util::{defer, maybe, post_inc, RangeExt, ResultExt, TryFutureExt}; -use workspace::item::ItemHandle; -use workspace::notifications::NotificationId; use workspace::{ - item::{TabBarPlacement, TabsSettings}, - searchable::SearchEvent, - ItemNavHistory, SplitDirection, Toast, ViewId, Workspace, WorkspaceId, + item::ItemHandle, notifications::NotificationId, searchable::SearchEvent, ItemNavHistory, + SplitDirection, TabBarPlacement, TabBarSettings, Toast, ViewId, Workspace, WorkspaceId, }; use crate::hover_links::find_url; @@ -1450,7 +1447,7 @@ impl Editor { blink_manager: blink_manager.clone(), show_local_selections: true, mode, - tab_bar_placement: TabsSettings::get_global(cx).placement, + tab_bar_placement: TabBarSettings::get_global(cx).placement, show_breadcrumbs: EditorSettings::get_global(cx).toolbar.breadcrumbs, show_gutter: mode == EditorMode::Full, show_wrap_guides: None, @@ -9449,7 +9446,7 @@ impl Editor { let editor_settings = EditorSettings::get_global(cx); self.scroll_manager.vertical_scroll_margin = editor_settings.vertical_scroll_margin; self.show_breadcrumbs = editor_settings.toolbar.breadcrumbs; - self.tab_bar_placement = TabsSettings::get_global(cx).placement; + self.tab_bar_placement = TabBarSettings::get_global(cx).placement; cx.notify(); } diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index b2bef9ee48..81bd1da807 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -19,7 +19,10 @@ use project::repository::GitFileStatus; use project::{search::SearchQuery, FormatTrigger, Item as _, Project, ProjectPath}; use rpc::proto::{self, update_view, PeerId}; use settings::Settings; -use workspace::item::{TabBarPlacement, TabContentParams, TabsSettings}; +use workspace::{ + item::{TabContentParams, TabsSettings}, + TabBarPlacement, +}; use std::{ borrow::Cow, diff --git a/crates/workspace/src/item.rs b/crates/workspace/src/item.rs index a0a689ac19..71ca557b54 100644 --- a/crates/workspace/src/item.rs +++ b/crates/workspace/src/item.rs @@ -2,7 +2,7 @@ use crate::{ pane::{self, Pane}, persistence::model::ItemId, searchable::SearchableItemHandle, - workspace_settings::{AutosaveSetting, WorkspaceSettings}, + workspace_settings::{AutosaveSetting, TabBarPlacement, WorkspaceSettings}, DelayedDebouncedEditAction, FollowableItemBuilders, ItemNavHistory, ToolbarItemLocation, ViewId, Workspace, WorkspaceId, }; @@ -38,23 +38,10 @@ pub const LEADER_UPDATE_THROTTLE: Duration = Duration::from_millis(200); #[derive(Deserialize)] pub struct TabsSettings { - pub placement: TabBarPlacement, pub git_status: bool, pub close_position: ClosePosition, } -/// The tab bar placement in a pane. -#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)] -#[serde(rename_all = "snake_case")] -pub enum TabBarPlacement { - /// Don't show tab bar. - No, - /// Place tab bar on top of the pane. - Top, - /// Place tab bar at the bottom of the pane. - Bottom, -} - #[derive(Deserialize)] pub struct PreviewTabsSettings { pub enabled: bool, @@ -80,10 +67,6 @@ impl ClosePosition { #[derive(Clone, Default, Serialize, Deserialize, JsonSchema)] pub struct TabsSettingsContent { - /// Where to place tab bar in the editor. - /// - /// Default: top - pub placement: Option, /// Whether to show the Git file status on a tab item. /// /// Default: false diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index e13ed06b31..7a1942bc74 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1,10 +1,10 @@ use crate::{ item::{ - ClosePosition, Item, ItemHandle, PreviewTabsSettings, TabBarPlacement, TabContentParams, - TabsSettings, WeakItemHandle, + ClosePosition, Item, ItemHandle, PreviewTabsSettings, TabContentParams, TabsSettings, + WeakItemHandle, }, toolbar::Toolbar, - workspace_settings::{AutosaveSetting, TabBarSettings, WorkspaceSettings}, + workspace_settings::{AutosaveSetting, TabBarPlacement, TabBarSettings, WorkspaceSettings}, NewCenterTerminal, NewFile, NewSearch, OpenVisible, SplitDirection, ToggleZoom, Workspace, }; use anyhow::Result; diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 898e80f5a5..ea01fcda31 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -85,7 +85,7 @@ use ui::{ use util::ResultExt; use uuid::Uuid; pub use workspace_settings::{ - AutosaveSetting, RestoreOnStartupBehaviour, TabBarSettings, WorkspaceSettings, + AutosaveSetting, RestoreOnStartupBehaviour, TabBarPlacement, TabBarSettings, WorkspaceSettings, }; use crate::notifications::NotificationId; diff --git a/crates/workspace/src/workspace_settings.rs b/crates/workspace/src/workspace_settings.rs index dbc9c52bcd..0dc06d7750 100644 --- a/crates/workspace/src/workspace_settings.rs +++ b/crates/workspace/src/workspace_settings.rs @@ -49,13 +49,30 @@ pub struct WorkspaceSettingsContent { pub restore_on_startup: Option, } +/// The tab bar placement in a pane. +#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)] +#[serde(rename_all = "snake_case")] +pub enum TabBarPlacement { + /// Don't show tab bar. + No, + /// Place tab bar on top of the pane. + Top, + /// Place tab bar at the bottom of the pane. + Bottom, +} + #[derive(Deserialize)] pub struct TabBarSettings { + pub placement: TabBarPlacement, pub show_nav_history_buttons: bool, } #[derive(Clone, Default, Serialize, Deserialize, JsonSchema)] pub struct TabBarSettingsContent { + /// Where to place tab bar in the editor. + /// + /// Default: top + pub placement: Option, /// Whether or not to show the navigation history buttons in the tab bar. /// /// Default: true