LSP range formatting converts indentation to tabs, inconsistent with full-file format #11085
Labels
A-language-server
Area: Language server client
C-bug
Category: This is a bug
E-easy
Call for participation: Experience needed to fix: Easy / not much
E-good-first-issue
Call for participation: Issues suitable for new contributors
E-has-instructions
Call for participation: Has instructions for fixing the issue and opening a PR
When I format with
:format
(or auto-format on save), I get spaces for indentation. But when I format a selection using=
, the spaces are replaced by tabs.By running with
hx -v
and watching the log, I see this when I use:format
:And this when I press
=
:It seems the
:format
command is sending the options{"insertSpaces":true,"tabSize":2}
to the LSP, while the=
command is sending{"insertSpaces":false,"tabSize":0}
.I was trying to search around for whether this was just something I needed to configure separately for some reason, but although I don't really know Rust it seems to me that the problem is here:
helix/helix-term/src/commands.rs
Lines 4527 to 4531 in fc97ecc
This is (I think) just passing the default value for
lsp::FormattingOptions
regardless of configuration, as opposed to what I see here:helix/helix-view/src/document.rs
Lines 812 to 818 in fc97ecc
Where it seems to be using Helix's settings for indentation to set those parameters.
(I'm observing this with vscode-json-language-server, but the issue doesn't seem to be related to the particular LSP server)
The text was updated successfully, but these errors were encountered: