This breaks setting `{"scrollbar": {"show":"never"}}` Release Notes: - N/A
This commit is contained in:
parent
3b37db4140
commit
4d26f83d23
49 changed files with 686 additions and 833 deletions
|
@ -2,7 +2,6 @@ use gpui::Pixels;
|
|||
use schemars::JsonSchema;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use settings::{Settings, SettingsSources};
|
||||
use ui::px;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, Copy, PartialEq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
|
@ -11,50 +10,20 @@ pub enum ProjectPanelDockPosition {
|
|||
Right,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug, Clone, Copy, PartialEq, JsonSchema)]
|
||||
#[serde(default)]
|
||||
#[derive(Deserialize, Debug, Clone, Copy, PartialEq)]
|
||||
pub struct ProjectPanelSettings {
|
||||
/// Whether to show the project panel button in the status bar.
|
||||
pub button: bool,
|
||||
/// Customize default width (in pixels) taken by project panel
|
||||
pub default_width: Pixels,
|
||||
/// The position of project panel
|
||||
pub dock: ProjectPanelDockPosition,
|
||||
/// Whether to show file icons in the project panel.
|
||||
pub file_icons: bool,
|
||||
/// Whether to show folder icons or chevrons for directories in the project panel.
|
||||
pub folder_icons: bool,
|
||||
/// Whether to show the git status in the project panel.
|
||||
pub git_status: bool,
|
||||
/// Amount of indentation (in pixels) for nested items.
|
||||
pub indent_size: Pixels,
|
||||
/// Whether to reveal it in the project panel automatically,
|
||||
/// when a corresponding project entry becomes active.
|
||||
/// Gitignored entries are never auto revealed.
|
||||
pub indent_size: f32,
|
||||
pub auto_reveal_entries: bool,
|
||||
/// Whether to fold directories automatically
|
||||
/// when directory has only one directory inside.
|
||||
pub auto_fold_dirs: bool,
|
||||
/// Scrollbar-related settings
|
||||
pub scrollbar: ScrollbarSettings,
|
||||
}
|
||||
|
||||
impl Default for ProjectPanelSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
button: true,
|
||||
default_width: px(240.),
|
||||
dock: ProjectPanelDockPosition::Left,
|
||||
file_icons: true,
|
||||
folder_icons: true,
|
||||
git_status: true,
|
||||
indent_size: px(20.),
|
||||
auto_reveal_entries: true,
|
||||
auto_fold_dirs: true,
|
||||
scrollbar: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
/// When to show the scrollbar in the project panel.
|
||||
///
|
||||
/// Default: always
|
||||
|
@ -68,7 +37,7 @@ pub enum ShowScrollbar {
|
|||
Never,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Default, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
|
||||
pub struct ScrollbarSettings {
|
||||
/// When to show the scrollbar in the project panel.
|
||||
///
|
||||
|
@ -76,10 +45,63 @@ pub struct ScrollbarSettings {
|
|||
pub show: ShowScrollbar,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
|
||||
pub struct ScrollbarSettingsContent {
|
||||
/// When to show the scrollbar in the project panel.
|
||||
///
|
||||
/// Default: always
|
||||
pub show: Option<ShowScrollbar>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
|
||||
pub struct ProjectPanelSettingsContent {
|
||||
/// Whether to show the project panel button in the status bar.
|
||||
///
|
||||
/// Default: true
|
||||
pub button: Option<bool>,
|
||||
/// Customize default width (in pixels) taken by project panel
|
||||
///
|
||||
/// Default: 240
|
||||
pub default_width: Option<f32>,
|
||||
/// The position of project panel
|
||||
///
|
||||
/// Default: left
|
||||
pub dock: Option<ProjectPanelDockPosition>,
|
||||
/// Whether to show file icons in the project panel.
|
||||
///
|
||||
/// Default: true
|
||||
pub file_icons: Option<bool>,
|
||||
/// Whether to show folder icons or chevrons for directories in the project panel.
|
||||
///
|
||||
/// Default: true
|
||||
pub folder_icons: Option<bool>,
|
||||
/// Whether to show the git status in the project panel.
|
||||
///
|
||||
/// Default: true
|
||||
pub git_status: Option<bool>,
|
||||
/// Amount of indentation (in pixels) for nested items.
|
||||
///
|
||||
/// Default: 20
|
||||
pub indent_size: Option<f32>,
|
||||
/// Whether to reveal it in the project panel automatically,
|
||||
/// when a corresponding project entry becomes active.
|
||||
/// Gitignored entries are never auto revealed.
|
||||
///
|
||||
/// Default: true
|
||||
pub auto_reveal_entries: Option<bool>,
|
||||
/// Whether to fold directories automatically
|
||||
/// when directory has only one directory inside.
|
||||
///
|
||||
/// Default: false
|
||||
pub auto_fold_dirs: Option<bool>,
|
||||
/// Scrollbar-related settings
|
||||
pub scrollbar: Option<ScrollbarSettingsContent>,
|
||||
}
|
||||
|
||||
impl Settings for ProjectPanelSettings {
|
||||
const KEY: Option<&'static str> = Some("project_panel");
|
||||
|
||||
type FileContent = Self;
|
||||
type FileContent = ProjectPanelSettingsContent;
|
||||
|
||||
fn load(
|
||||
sources: SettingsSources<Self::FileContent>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue