worktree_settings.rs

 1use gpui::AppContext;
 2use schemars::JsonSchema;
 3use serde::{Deserialize, Serialize};
 4use settings::{Settings, SettingsSources};
 5
 6#[derive(Clone, Default, Serialize, Deserialize, JsonSchema)]
 7pub struct WorktreeSettings {
 8    /// Completely ignore files matching globs from `file_scan_exclusions`
 9    ///
10    /// Default: [
11    ///   "**/.git",
12    ///   "**/.svn",
13    ///   "**/.hg",
14    ///   "**/CVS",
15    ///   "**/.DS_Store",
16    ///   "**/Thumbs.db",
17    ///   "**/.classpath",
18    ///   "**/.settings"
19    /// ]
20    #[serde(default)]
21    pub file_scan_exclusions: Option<Vec<String>>,
22
23    /// Treat the files matching these globs as `.env` files.
24    /// Default: [ "**/.env*" ]
25    pub private_files: Option<Vec<String>>,
26}
27
28impl Settings for WorktreeSettings {
29    const KEY: Option<&'static str> = None;
30
31    type FileContent = Self;
32
33    fn load(
34        sources: SettingsSources<Self::FileContent>,
35        _: &mut AppContext,
36    ) -> anyhow::Result<Self> {
37        sources.json_merge()
38    }
39}