1
0
Fork 0

lsp: Refactor to allow server settings

This commit is contained in:
Felipe 2023-03-28 02:07:12 -03:00
parent c0e5b1749e
commit dccd511bf7
Signed by: pitbuster
SSH key fingerprint: SHA256:HDYu2Pm4/TmSX8GBwV49UvFWr1Ljg8XlHxKeCpjJpOk

View file

@ -139,16 +139,16 @@ end
-- Use a loop to conveniently call 'setup' on multiple servers and -- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches -- map buffer local keybindings when the language server attaches
local servers = { local servers = {
'clangd', clangd,
'gopls', gopls,
'jsonls', jsonls,
'kotlin_language_server', kotlin_language_server,
'marksman', marksman,
'rust_analyzer', pylsp,
'texlab', rust_analyzer,
'tflint', texlab,
'tsserver', tflint,
'pylsp' tsserver,
} }
-- Setup loop moved to the cmp section, since calling setup multiple times -- Setup loop moved to the cmp section, since calling setup multiple times
-- overrides the previous calls. -- overrides the previous calls.
@ -216,13 +216,23 @@ cmp.setup({
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
lsp.util.default_config = vim.tbl_deep_extend( lsp.util.default_config = vim.tbl_deep_extend(
'force', lsp.util.default_config, { capabilities = capabilities, }) 'force', lsp.util.default_config, { capabilities = capabilities, })
for _, server in pairs(servers) do for server, settings in pairs(servers) do
lsp[server].setup { if settings then
lsp[server].setup({
on_attach = on_lsp_attach, on_attach = on_lsp_attach,
flags = { flags = {
debounce_text_changes = 150, debounce_text_changes = 150,
} },
} settings = settings,
})
else
lsp[server].setup({
on_attach = on_lsp_attach,
flags = {
debounce_text_changes = 150,
},
})
end
end end
---- git-blame.nvim ---- git-blame.nvim
g.gitblame_enabled = 0 g.gitblame_enabled = 0