Do not attempt to install prettier if the language change is unrelated (#19283)

Release Notes:

- Fix prettier install being attempted too much
This commit is contained in:
Kirill Bulatov 2024-10-16 18:10:05 +03:00 committed by GitHub
parent 598939d186
commit bcdb10b3cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 15 deletions

View file

@ -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 {