settings.rs

 1use gpui::Pixels;
 2use schemars::JsonSchema;
 3use serde_derive::{Deserialize, Serialize};
 4use settings::{Settings, SettingsSources};
 5use workspace::dock::DockPosition;
 6
 7#[derive(Deserialize, Debug)]
 8pub struct GitPanelSettings {
 9    pub button: bool,
10    pub dock: DockPosition,
11    pub default_width: Pixels,
12}
13
14#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
15pub struct PanelSettingsContent {
16    /// Whether to show the panel button in the status bar.
17    ///
18    /// Default: true
19    pub button: Option<bool>,
20    /// Where to dock the panel.
21    ///
22    /// Default: left
23    pub dock: Option<DockPosition>,
24    /// Default width of the panel in pixels.
25    ///
26    /// Default: 360
27    pub default_width: Option<f32>,
28}
29
30impl Settings for GitPanelSettings {
31    const KEY: Option<&'static str> = Some("git_panel");
32
33    type FileContent = PanelSettingsContent;
34
35    fn load(
36        sources: SettingsSources<Self::FileContent>,
37        _: &mut gpui::AppContext,
38    ) -> anyhow::Result<Self> {
39        sources.json_merge()
40    }
41}