1use anyhow::Result;
2use schemars::JsonSchema;
3use serde_derive::{Deserialize, Serialize};
4use settings::{Settings, SettingsSources};
5
6#[derive(Deserialize, Debug, Clone, Copy, PartialEq)]
7pub struct FileFinderSettings {
8 pub file_icons: bool,
9 pub modal_max_width: Option<FileFinderWidth>,
10}
11
12#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
13pub struct FileFinderSettingsContent {
14 /// Whether to show file icons in the file finder.
15 ///
16 /// Default: true
17 pub file_icons: Option<bool>,
18 /// Determines how much space the file finder can take up in relation to the available window width.
19 ///
20 /// Default: small
21 pub modal_max_width: Option<FileFinderWidth>,
22}
23
24impl Settings for FileFinderSettings {
25 const KEY: Option<&'static str> = Some("file_finder");
26
27 type FileContent = FileFinderSettingsContent;
28
29 fn load(sources: SettingsSources<Self::FileContent>, _: &mut gpui::App) -> Result<Self> {
30 sources.json_merge()
31 }
32}
33
34#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Serialize, Deserialize, JsonSchema)]
35#[serde(rename_all = "lowercase")]
36pub enum FileFinderWidth {
37 #[default]
38 Small,
39 Medium,
40 Large,
41 XLarge,
42 Full,
43}