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:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user