Move the placement setting to tab_bar
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<TabBarPlacement>,
|
||||
/// Whether to show the Git file status on a tab item.
|
||||
///
|
||||
/// Default: false
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -49,13 +49,30 @@ pub struct WorkspaceSettingsContent {
|
||||
pub restore_on_startup: Option<RestoreOnStartupBehaviour>,
|
||||
}
|
||||
|
||||
/// 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<TabBarPlacement>,
|
||||
/// Whether or not to show the navigation history buttons in the tab bar.
|
||||
///
|
||||
/// Default: true
|
||||
|
||||
Reference in New Issue
Block a user