use anyhow; use gpui::Pixels; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsSources}; #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, Copy, PartialEq)] #[serde(rename_all = "snake_case")] pub enum OutlinePanelDockPosition { Left, Right, } #[derive(Deserialize, Debug, Clone, Copy, PartialEq)] 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, /// Customise default width (in pixels) taken by outline panel /// /// Default: 240 pub default_width: Option, /// The position of outline panel /// /// Default: left pub dock: Option, /// Whether to show file icons in the outline panel. /// /// Default: true pub file_icons: Option, /// Whether to show folder icons or chevrons for directories in the outline panel. /// /// Default: true pub folder_icons: Option, /// Whether to show the git status in the outline panel. /// /// Default: true pub git_status: Option, /// Amount of indentation (in pixels) for nested items. /// /// Default: 20 pub indent_size: Option, /// 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, /// Whether to fold directories automatically /// when directory has only one directory inside. /// /// Default: true pub auto_fold_dirs: Option, } impl Settings for OutlinePanelSettings { const KEY: Option<&'static str> = Some("outline_panel"); type FileContent = OutlinePanelSettingsContent; fn load( sources: SettingsSources, _: &mut gpui::AppContext, ) -> anyhow::Result { sources.json_merge() } }