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
-25
View File
@@ -138,10 +138,6 @@ impl Settings for ProxySettings {
proxy: content.proxy.clone(),
}
}
fn import_from_vscode(vscode: &settings::VsCodeSettings, current: &mut SettingsContent) {
vscode.string_setting("http.proxy", &mut current.proxy);
}
}
pub fn init_settings(cx: &mut App) {
@@ -525,27 +521,6 @@ impl settings::Settings for TelemetrySettings {
metrics: content.telemetry.as_ref().unwrap().metrics.unwrap(),
}
}
fn import_from_vscode(vscode: &settings::VsCodeSettings, current: &mut SettingsContent) {
let mut telemetry = settings::TelemetrySettingsContent::default();
vscode.enum_setting("telemetry.telemetryLevel", &mut telemetry.metrics, |s| {
Some(s == "all")
});
vscode.enum_setting(
"telemetry.telemetryLevel",
&mut telemetry.diagnostics,
|s| Some(matches!(s, "all" | "error" | "crash")),
);
// we could translate telemetry.telemetryLevel, but just because users didn't want
// to send microsoft telemetry doesn't mean they don't want to send it to zed. their
// all/error/crash/off correspond to combinations of our "diagnostics" and "metrics".
if let Some(diagnostics) = telemetry.diagnostics {
current.telemetry.get_or_insert_default().diagnostics = Some(diagnostics)
}
if let Some(metrics) = telemetry.metrics {
current.telemetry.get_or_insert_default().metrics = Some(metrics)
}
}
}
impl Client {