ceigh
December 4, 2021, 1:09pm
1
Hello,
I use volar + stylelint_lsp, when I try to format a vue file, a window opens each time with a choice of formatter:
Select a language server:
(1) stylelint_lsp, (2) volar:
So, how can I assign stylelint_lsp as the default formatter for vue files?
Or how can I disable formatting at all for volar?
I use this code for autoformatting:
vim.cmd 'au BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()'
Hacky right now, but you can do:
require("lspconfig").volar.setup({
on_attach = function(client)
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
end,
})
or pass the list of client_ids in formatting_seq_sync
ceigh
December 4, 2021, 2:09pm
3
Thanks, it works!
if it’s not difficult for you, can you direct me to the current capabilities documentation?
I don’t know what you mean by current_capabilities documentation, this isn’t the “intended” way to do this (we never really anticipated the rise of multiple language servers). 0.7 will add a better API for this.