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 fn import_from_vscode(_vscode: &settings::VsCodeSettings, _current: &mut Self::FileContent) {}
34}
35
36#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Serialize, Deserialize, JsonSchema)]
37#[serde(rename_all = "lowercase")]
38pub enum FileFinderWidth {
39 #[default]
40 Small,
41 Medium,
42 Large,
43 XLarge,
44 Full,
45}