diff --git a/assets/settings/default.json b/assets/settings/default.json index 08d85dd723cc13ca98b0b239a199b263f738d99a..4a21b708eef99dc0193fc57910b48e505fe2cee8 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -268,6 +268,18 @@ // Whether to show warnings or not by default. "include_warnings": true }, + // TODO kb docs + "scan_exclude_files": [ + "**/.git", + "**/.svn", + "**/.hg", + "**/CVS", + "**/.DS_Store", + "**/Thumbs.db", + "**/.classpath", + "**/.settings", + "**/target" + ], // Git gutter behavior configuration. "git": { // Control whether the git gutter is shown. May take 2 values: diff --git a/crates/project/src/project_settings.rs b/crates/project/src/project_settings.rs index 7cbcc32d4ee9dc25ab0b7bf0abbef122d54ca9f5..511241bc22df8a2fb3c45478a76336aec7d8fc7c 100644 --- a/crates/project/src/project_settings.rs +++ b/crates/project/src/project_settings.rs @@ -12,7 +12,7 @@ pub struct ProjectSettings { pub git: GitSettings, // TODO kb better names and docs and tests #[serde(default)] - pub scan_exclude_files: Vec, + pub scan_exclude_files: Option>, } #[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema)] diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index 316878030508adf732c3041a364255d360f3b931..41fd647c9ced85410aa1bd7142ead3a2eca55474 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -650,7 +650,7 @@ fn start_background_scan_tasks( } fn scan_exclude_files(project_settings: &ProjectSettings) -> Vec { - project_settings.scan_exclude_files.iter() + project_settings.scan_exclude_files.as_deref().unwrap_or(&[]).iter() .sorted() .filter_map(|pattern| { PathMatcher::new(pattern) diff --git a/crates/project/src/worktree_tests.rs b/crates/project/src/worktree_tests.rs index 1fb4aa9a3474740d31f1fab5519b90b502758f4c..79ac25a1476fb221fb3f4faa41d1acb1aca11073 100644 --- a/crates/project/src/worktree_tests.rs +++ b/crates/project/src/worktree_tests.rs @@ -910,7 +910,7 @@ async fn test_ignore_inclusions_and_exclusions(cx: &mut TestAppContext) { cx.update_global::(|store, cx| { store.update_user_settings::(cx, |project_settings| { project_settings.scan_exclude_files = - vec!["**/foo/**".to_string(), "**/.DS_Store".to_string()]; + Some(vec!["**/foo/**".to_string(), "**/.DS_Store".to_string()]); }); }); });