lemminx
lemminx copied to clipboard
xml.format.tabSize and xml.format.insertSpaces have no effect in Neovim
I am currently trying the lemminx
server in Neovim and I'm having a hard time setting the tabSize
option. My config looks like this:
settings = {
xml = {
format = {
enabled = true,
splitAttributes = false,
spaceBeforeEmptyCloseTag = true,
insertSpaces = true,
tabSize = 10,
},
},
},
However, when I am formatting an XML file, the effective tabSize
is 4, not 10 (or any other value I set). A tab size of 4 and the use of spaces are derived from my Neovim options. These options can been seen in the LSP logs for the lemminx
server for formatting requests:
...
[DEBUG][2024-08-25 02:01:32] ...m/lsp/client.lua:676 "LSP[lemminx]" "client.request" 1 "textDocument/formatting" { options = { insertSpaces = true, tabSize = 4 }, textDocument = { uri = "file:///path/to/file.xml" }} <function 1> 13
[DEBUG][2024-08-25 02:01:32] .../vim/lsp/rpc.lua:286 "rpc.send" { id = 20, jsonrpc = "2.0", method = "textDocument/formatting", params = { options = { insertSpaces = true, tabSize = 4 }, textDocument = { uri = "file:///path/to/file.xml" } }}
...
The xml.format.tabSize
and xml.format.insertSpaces
values do not end up in the formatting_options
table and Neovim uses the global options for these fields, as documented, to format the file.
The options passed by the user in xml.format
that are shared with FormattingOptions should override the latter.
I do not currently know if this is a lemminx
issue or a Neovim LSP client issue.
The other options set in the xml.format
seem to be working.
LemMinX: 0.27.1 Neovim: v0.10.0 OS: Ubuntu 22.04.4 LTS