VSCode settings import refactor (#40513)

A small follow-up to the settings refactor of a few weeks ago to move
all the VSCode settings imports
to one place.

This should make it easier to spot missing imports, and easier to test
the importer.

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin
2025-10-17 17:47:05 +00:00
committed by GitHub
parent 62858f6a5c
commit 1fbe1e3512
19 changed files with 774 additions and 924 deletions
+1 -26
View File
@@ -1,7 +1,7 @@
use std::path::Path;
use anyhow::Context as _;
use settings::{Settings, SettingsContent};
use settings::Settings;
use util::{
ResultExt,
paths::{PathMatcher, PathStyle},
@@ -64,31 +64,6 @@ impl Settings for WorktreeSettings {
.unwrap_or_default(),
}
}
fn import_from_vscode(vscode: &settings::VsCodeSettings, current: &mut SettingsContent) {
if let Some(inclusions) = vscode
.read_value("files.watcherInclude")
.and_then(|v| v.as_array())
.and_then(|v| v.iter().map(|n| n.as_str().map(str::to_owned)).collect())
{
if let Some(old) = current.project.worktree.file_scan_inclusions.as_mut() {
old.extend(inclusions)
} else {
current.project.worktree.file_scan_inclusions = Some(inclusions)
}
}
if let Some(exclusions) = vscode
.read_value("files.watcherExclude")
.and_then(|v| v.as_array())
.and_then(|v| v.iter().map(|n| n.as_str().map(str::to_owned)).collect())
{
if let Some(old) = current.project.worktree.file_scan_exclusions.as_mut() {
old.extend(exclusions)
} else {
current.project.worktree.file_scan_exclusions = Some(exclusions)
}
}
}
}
fn path_matchers(mut values: Vec<String>, context: &'static str) -> anyhow::Result<PathMatcher> {