settings: Remove auxiliary Content types where possible (#16744)
Release Notes: - N/A
This commit is contained in:
parent
8f28445612
commit
ccf6f27b8f
49 changed files with 843 additions and 696 deletions
|
@ -1,4 +1,5 @@
|
|||
use gpui::Pixels;
|
||||
use anyhow;
|
||||
use gpui::{px, Pixels};
|
||||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use settings::{Settings, SettingsSources};
|
||||
|
@ -10,66 +11,51 @@ pub enum OutlinePanelDockPosition {
|
|||
Right,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(Deserialize, Serialize, Debug, Clone, Copy, PartialEq, JsonSchema)]
|
||||
pub struct OutlinePanelSettings {
|
||||
pub button: bool,
|
||||
pub default_width: Pixels,
|
||||
pub dock: OutlinePanelDockPosition,
|
||||
pub file_icons: bool,
|
||||
pub folder_icons: bool,
|
||||
pub git_status: bool,
|
||||
pub indent_size: f32,
|
||||
pub auto_reveal_entries: bool,
|
||||
pub auto_fold_dirs: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
|
||||
pub struct OutlinePanelSettingsContent {
|
||||
/// Whether to show the outline panel button in the status bar.
|
||||
///
|
||||
/// Default: true
|
||||
pub button: Option<bool>,
|
||||
pub button: bool,
|
||||
/// Customize default width (in pixels) taken by outline panel
|
||||
///
|
||||
/// Default: 240
|
||||
pub default_width: Option<f32>,
|
||||
pub default_width: Pixels,
|
||||
/// The position of outline panel
|
||||
///
|
||||
/// Default: left
|
||||
pub dock: Option<OutlinePanelDockPosition>,
|
||||
pub dock: OutlinePanelDockPosition,
|
||||
/// Whether to show file icons in the outline panel.
|
||||
///
|
||||
/// Default: true
|
||||
pub file_icons: Option<bool>,
|
||||
pub file_icons: bool,
|
||||
/// Whether to show folder icons or chevrons for directories in the outline panel.
|
||||
///
|
||||
/// Default: true
|
||||
pub folder_icons: Option<bool>,
|
||||
pub folder_icons: bool,
|
||||
/// Whether to show the git status in the outline panel.
|
||||
///
|
||||
/// Default: true
|
||||
pub git_status: Option<bool>,
|
||||
pub git_status: bool,
|
||||
/// Amount of indentation (in pixels) for nested items.
|
||||
///
|
||||
/// Default: 20
|
||||
pub indent_size: Option<f32>,
|
||||
pub indent_size: Pixels,
|
||||
/// Whether to reveal it in the outline panel automatically,
|
||||
/// when a corresponding project entry becomes active.
|
||||
/// Gitignored entries are never auto revealed.
|
||||
///
|
||||
/// Default: true
|
||||
pub auto_reveal_entries: Option<bool>,
|
||||
pub auto_reveal_entries: bool,
|
||||
/// Whether to fold directories automatically
|
||||
/// when directory has only one directory inside.
|
||||
///
|
||||
/// Default: true
|
||||
pub auto_fold_dirs: Option<bool>,
|
||||
pub auto_fold_dirs: bool,
|
||||
}
|
||||
|
||||
impl Default for OutlinePanelSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
button: true,
|
||||
default_width: px(240.),
|
||||
dock: OutlinePanelDockPosition::Left,
|
||||
file_icons: true,
|
||||
folder_icons: true,
|
||||
auto_fold_dirs: true,
|
||||
auto_reveal_entries: true,
|
||||
indent_size: px(20.),
|
||||
git_status: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Settings for OutlinePanelSettings {
|
||||
const KEY: Option<&'static str> = Some("outline_panel");
|
||||
|
||||
type FileContent = OutlinePanelSettingsContent;
|
||||
type FileContent = Self;
|
||||
|
||||
fn load(
|
||||
sources: SettingsSources<Self::FileContent>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue