1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

fix(lsp): ignore editor indent settings if deno.json is present (#26912)

This commit is contained in:
Nayeem Rahman 2024-11-18 21:45:34 +00:00 committed by GitHub
parent 19bbf83e47
commit c36f877f8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -1396,9 +1396,11 @@ impl Inner {
.fmt_config_for_specifier(&specifier) .fmt_config_for_specifier(&specifier)
.options .options
.clone(); .clone();
fmt_options.use_tabs = Some(!params.options.insert_spaces);
fmt_options.indent_width = Some(params.options.tab_size as u8);
let config_data = self.config.tree.data_for_specifier(&specifier); let config_data = self.config.tree.data_for_specifier(&specifier);
if !config_data.is_some_and(|d| d.maybe_deno_json().is_some()) {
fmt_options.use_tabs = Some(!params.options.insert_spaces);
fmt_options.indent_width = Some(params.options.tab_size as u8);
}
let unstable_options = UnstableFmtOptions { let unstable_options = UnstableFmtOptions {
component: config_data component: config_data
.map(|d| d.unstable.contains("fmt-component")) .map(|d| d.unstable.contains("fmt-component"))

View file

@ -11680,7 +11680,7 @@ fn lsp_format_with_config() {
}, },
"options": { "options": {
"tabSize": 2, "tabSize": 2,
"insertSpaces": false "insertSpaces": true,
} }
}), }),
); );