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 pub skip_focus_for_active_in_search: bool,
11}
12
13#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
14pub struct FileFinderSettingsContent {
15 /// Whether to show file icons in the file finder.
16 ///
17 /// Default: true
18 pub file_icons: Option<bool>,
19 /// Determines how much space the file finder can take up in relation to the available window width.
20 ///
21 /// Default: small
22 pub modal_max_width: Option<FileFinderWidth>,
23 /// Determines whether the file finder should skip focus for the active file in search results.
24 ///
25 /// Default: true
26 pub skip_focus_for_active_in_search: Option<bool>,
27}
28
29impl Settings for FileFinderSettings {
30 const KEY: Option<&'static str> = Some("file_finder");
31
32 type FileContent = FileFinderSettingsContent;
33
34 fn load(sources: SettingsSources<Self::FileContent>, _: &mut gpui::App) -> Result<Self> {
35 sources.json_merge()
36 }
37
38 fn import_from_vscode(_vscode: &settings::VsCodeSettings, _current: &mut Self::FileContent) {}
39}
40
41#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Serialize, Deserialize, JsonSchema)]
42#[serde(rename_all = "lowercase")]
43pub enum FileFinderWidth {
44 #[default]
45 Small,
46 Medium,
47 Large,
48 XLarge,
49 Full,
50}