1use anyhow;
2use gpui::Pixels;
3use schemars::JsonSchema;
4use serde_derive::{Deserialize, Serialize};
5use settings::Settings;
6
7#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
8#[serde(rename_all = "snake_case")]
9pub enum ProjectPanelDockPosition {
10 Left,
11 Right,
12}
13
14#[derive(Deserialize, Debug)]
15pub struct ProjectPanelSettings {
16 pub default_width: Pixels,
17 pub dock: ProjectPanelDockPosition,
18 pub file_icons: bool,
19 pub folder_icons: bool,
20 pub git_status: bool,
21 pub indent_size: f32,
22 pub auto_reveal_entries: bool,
23}
24
25#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
26pub struct ProjectPanelSettingsContent {
27 pub default_width: Option<f32>,
28 pub dock: Option<ProjectPanelDockPosition>,
29 pub file_icons: Option<bool>,
30 pub folder_icons: Option<bool>,
31 pub git_status: Option<bool>,
32 pub indent_size: Option<f32>,
33 pub auto_reveal_entries: Option<bool>,
34}
35
36impl Settings for ProjectPanelSettings {
37 const KEY: Option<&'static str> = Some("project_panel");
38
39 type FileContent = ProjectPanelSettingsContent;
40
41 fn load(
42 default_value: &Self::FileContent,
43 user_values: &[&Self::FileContent],
44 _: &mut gpui::AppContext,
45 ) -> anyhow::Result<Self> {
46 Self::load_via_json_merge(default_value, user_values)
47 }
48}