diff --git a/crates/oxc_language_server/src/main.rs b/crates/oxc_language_server/src/main.rs index f57fe92b964da..89a23a231f878 100644 --- a/crates/oxc_language_server/src/main.rs +++ b/crates/oxc_language_server/src/main.rs @@ -148,14 +148,7 @@ impl LanguageServer for Backend { self.init_nested_configs().await; } - if changed_options.fix_kind() != changed_options.fix_kind() { - self.init_linter_config().await; - self.revalidate_open_files().await; - } - - // revalidate the config and all open files - if changed_options.config_path != current_option.config_path { - info!("config path change detected {:?}", &changed_options.config_path); + if Self::needs_linter_restart(current_option, &changed_options) { self.init_linter_config().await; self.revalidate_open_files().await; } @@ -527,6 +520,12 @@ impl Backend { .await; } + fn needs_linter_restart(old_options: &Options, new_options: &Options) -> bool { + old_options.config_path != new_options.config_path + || old_options.disable_nested_configs() != new_options.disable_nested_configs() + || old_options.fix_kind() != new_options.fix_kind() + } + /// Searches inside root_uri recursively for the default oxlint config files /// and insert them inside the nested configuration async fn init_nested_configs(&self) {