Add default scan excluded files settings

This commit is contained in:
Kirill Bulatov 2023-11-14 22:55:06 +02:00
parent c52fe2f536
commit 26f7e66b49
4 changed files with 15 additions and 3 deletions

View file

@ -268,6 +268,18 @@
// Whether to show warnings or not by default. // Whether to show warnings or not by default.
"include_warnings": true "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 gutter behavior configuration.
"git": { "git": {
// Control whether the git gutter is shown. May take 2 values: // Control whether the git gutter is shown. May take 2 values:

View file

@ -12,7 +12,7 @@ pub struct ProjectSettings {
pub git: GitSettings, pub git: GitSettings,
// TODO kb better names and docs and tests // TODO kb better names and docs and tests
#[serde(default)] #[serde(default)]
pub scan_exclude_files: Vec<String>, pub scan_exclude_files: Option<Vec<String>>,
} }
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema)] #[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema)]

View file

@ -650,7 +650,7 @@ fn start_background_scan_tasks(
} }
fn scan_exclude_files(project_settings: &ProjectSettings) -> Vec<PathMatcher> { fn scan_exclude_files(project_settings: &ProjectSettings) -> Vec<PathMatcher> {
project_settings.scan_exclude_files.iter() project_settings.scan_exclude_files.as_deref().unwrap_or(&[]).iter()
.sorted() .sorted()
.filter_map(|pattern| { .filter_map(|pattern| {
PathMatcher::new(pattern) PathMatcher::new(pattern)

View file

@ -910,7 +910,7 @@ async fn test_ignore_inclusions_and_exclusions(cx: &mut TestAppContext) {
cx.update_global::<SettingsStore, _, _>(|store, cx| { cx.update_global::<SettingsStore, _, _>(|store, cx| {
store.update_user_settings::<ProjectSettings>(cx, |project_settings| { store.update_user_settings::<ProjectSettings>(cx, |project_settings| {
project_settings.scan_exclude_files = project_settings.scan_exclude_files =
vec!["**/foo/**".to_string(), "**/.DS_Store".to_string()]; Some(vec!["**/foo/**".to_string(), "**/.DS_Store".to_string()]);
}); });
}); });
}); });