diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2024-11-18 21:45:34 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-18 21:45:34 +0000 |
commit | c36f877f8d98f9756154e26809c614d6749b3fd1 (patch) | |
tree | 2ed76e8ce537a62efd4812a35c9cdf519abad29d | |
parent | 19bbf83e47e4f98a45fe1c735dd2cdab80b99eca (diff) |
fix(lsp): ignore editor indent settings if deno.json is present (#26912)
-rw-r--r-- | cli/lsp/language_server.rs | 6 | ||||
-rw-r--r-- | tests/integration/lsp_tests.rs | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index c93628555..2ce26c1f2 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -1396,9 +1396,11 @@ impl Inner { .fmt_config_for_specifier(&specifier) .options .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); + 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 { component: config_data .map(|d| d.unstable.contains("fmt-component")) diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index a5b0ee247..8eaccb548 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -11680,7 +11680,7 @@ fn lsp_format_with_config() { }, "options": { "tabSize": 2, - "insertSpaces": false + "insertSpaces": true, } }), ); |