neovim: disable lsp formatting for several servers

This commit is contained in:
2023-11-10 20:24:07 +03:00
parent 7874d29aca
commit e7b81ed423

View File

@@ -37,11 +37,13 @@ null_ls.setup({
end,
})
local lsp_server_without_formatting = { "tsserver", "html", "css", "eslint", "jsonls", "svelte" }
local function on_attach(client, bufnr)
local opts = { buffer = bufnr, remap = false }
-- disable tsserver formatting here because i don't understand how lsp configuration works
if client.name == "tsserver" then
if vim.list_contains(lsp_server_without_formatting, client.name) then
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
end