Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Do not attempt to install prettier if the language change is unrelated (#19283)
Kirill Bulatovbcdb10b3cb39
diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rsindex 41da302e469..d72f631bdcf 100644--- a/crates/project/src/lsp_store.rs+++ b/crates/project/src/lsp_store.rs@@ -1237,16 +1237,19 @@ impl LspStore {None};- if let Some(prettier_plugins) = prettier_store::prettier_plugins_for_language(&settings) {- let prettier_store = self.as_local().map(|s| s.prettier_store.clone());- if let Some(prettier_store) = prettier_store {- prettier_store.update(cx, |prettier_store, cx| {- prettier_store.install_default_prettier(- worktree_id,- prettier_plugins.iter().map(|s| Arc::from(s.as_str())),- cx,- )- })+ if settings.prettier.allowed {+ if let Some(prettier_plugins) = prettier_store::prettier_plugins_for_language(&settings)+ {+ let prettier_store = self.as_local().map(|s| s.prettier_store.clone());+ if let Some(prettier_store) = prettier_store {+ prettier_store.update(cx, |prettier_store, cx| {+ prettier_store.install_default_prettier(+ worktree_id,+ prettier_plugins.iter().map(|s| Arc::from(s.as_str())),+ cx,+ )+ })+ }}}diff --git a/crates/project/src/prettier_store.rs b/crates/project/src/prettier_store.rsindex 65e2aa2e767..b6c99e4a1eb 100644--- a/crates/project/src/prettier_store.rs+++ b/crates/project/src/prettier_store.rs@@ -610,11 +610,13 @@ impl PrettierStore {) {let mut prettier_plugins_by_worktree = HashMap::default();for (worktree, language_settings) in language_formatters_to_check {- if let Some(plugins) = prettier_plugins_for_language(&language_settings) {- prettier_plugins_by_worktree- .entry(worktree)- .or_insert_with(HashSet::default)- .extend(plugins.iter().cloned());+ if language_settings.prettier.allowed {+ if let Some(plugins) = prettier_plugins_for_language(&language_settings) {+ prettier_plugins_by_worktree+ .entry(worktree)+ .or_insert_with(HashSet::default)+ .extend(plugins.iter().cloned());+ }}}for (worktree, prettier_plugins) in prettier_plugins_by_worktree {