From 0cce0a9840bf374616162a856acefbf11520e59d Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Fri, 27 Nov 2026 10:28:13 +0800 Subject: [PATCH] fix(problems): start TypeScript Project Errors when the option is turned on (#6316) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The desktop app's settings_set has its own copy of the side effects of a changed setting, and the tsc --watch watcher was only started from the host command's copy, so turning on Problems › TypeScript Project Errors did nothing until the project was reopened. Both commands now share apply_setting, which also applies the terminal frame rate on desktop. --- crates/ide-host/src/ops/project.rs | 28 +++++++++++++++++----------- src-tauri/src/commands/app.rs | 4 +--- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/crates/ide-host/src/ops/project.rs b/crates/ide-host/src/ops/project.rs index 689653a403..220c844ddf 100644 --- a/crates/ide-host/src/ops/project.rs +++ b/crates/ide-host/src/ops/project.rs @@ -110,6 +110,22 @@ pub fn settings_removed_theme(host: &Host, window: &str) -> Option { } } +/// What a changed setting `key` starts or stops right away. Both `settings_set` commands (this +/// crate's and the desktop's) call it after writing the value. +pub fn apply_setting(host: &Arc, window: &str, key: &str) { + if key == "mcpServer" || key.starts_with("mcpServer.") { + host.mcp.apply(host); + } + if key == "terminal" || key.starts_with("terminal.") { + super::term::apply_output_rate(host, window); + } + if "languages.typescript.watchProblems".starts_with(key) + && let Some(watch) = host.project(window).ok().and_then(|p| p.tsc_watch.clone()) + { + watch.apply(&host.runtime); + } +} + /// `value` is JSON text, e.g. `14` or `"dark"`. Every window (for a project /// value: that project's windows) is told (`IdeEvent::SettingsChanged`) so it /// re-reads its effective settings. @@ -122,17 +138,7 @@ pub fn settings_set( value: String, ) -> IdeResult { let applied = set_settings(host, window, scope, &key, &value)?; - if key == "mcpServer" || key.starts_with("mcpServer.") { - host.mcp.apply(host); - } - if key == "terminal" || key.starts_with("terminal.") { - super::term::apply_output_rate(host, window); - } - if "languages.typescript.watchProblems".starts_with(&key) - && let Some(watch) = host.project(window).ok().and_then(|p| p.tsc_watch.clone()) - { - watch.apply(&host.runtime); - } + apply_setting(host, window, &key); let sink = host.window_sink(window); sink.emit(IdeEvent::SettingsChanged { key }); if let Some(root) = applied.roots_changed { diff --git a/src-tauri/src/commands/app.rs b/src-tauri/src/commands/app.rs index 42a4b6cf5c..e952413945 100644 --- a/src-tauri/src/commands/app.rs +++ b/src-tauri/src/commands/app.rs @@ -240,9 +240,7 @@ fn settings_set_now( value: &str, ) -> IdeResult { let applied = ide_host::ops::project::set_settings(&state.host, window, scope, key, value)?; - if key == "mcpServer" || key.starts_with("mcpServer.") { - state.host.mcp.apply(&state.host); - } + ide_host::ops::project::apply_setting(&state.host, window, key); if key == "toolDownloads" || key.starts_with("toolDownloads.") { state.plugins.set_downloads(state.host.global_settings.effective().tool_downloads); }