Fix language settings formatter regression - formatter list can be a single formatter not wrapped in an array (#33721)
Fixes a regression from #33635 Release Notes: - N/A
This commit is contained in:
parent
eb74df632b
commit
2ff155d5a2
6 changed files with 72 additions and 52 deletions
|
@ -1405,7 +1405,7 @@ impl LocalLspStore {
|
|||
|
||||
let formatters = match (trigger, &settings.format_on_save) {
|
||||
(FormatTrigger::Save, FormatOnSave::Off) => &[],
|
||||
(FormatTrigger::Save, FormatOnSave::List(formatters)) => formatters.as_slice(),
|
||||
(FormatTrigger::Save, FormatOnSave::List(formatters)) => formatters.as_ref(),
|
||||
(FormatTrigger::Manual, _) | (FormatTrigger::Save, FormatOnSave::On) => {
|
||||
match &settings.formatter {
|
||||
SelectedFormatter::Auto => {
|
||||
|
@ -1417,7 +1417,7 @@ impl LocalLspStore {
|
|||
std::slice::from_ref(&Formatter::LanguageServer { name: None })
|
||||
}
|
||||
}
|
||||
SelectedFormatter::List(formatter_list) => formatter_list.as_slice(),
|
||||
SelectedFormatter::List(formatter_list) => formatter_list.as_ref(),
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -705,6 +705,7 @@ pub fn prettier_plugins_for_language(
|
|||
SelectedFormatter::Auto => Some(&language_settings.prettier.plugins),
|
||||
|
||||
SelectedFormatter::List(list) => list
|
||||
.as_ref()
|
||||
.contains(&Formatter::Prettier)
|
||||
.then_some(&language_settings.prettier.plugins),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue