diff --git a/.config/nvim/plugin/lsp.lua b/.config/nvim/plugin/lsp.lua index c17ce4f0..9e5466b8 100644 --- a/.config/nvim/plugin/lsp.lua +++ b/.config/nvim/plugin/lsp.lua @@ -20,7 +20,9 @@ local servers = { -- golangci_lint_ls = {}, tinymist = {}, nil_ls = { - ["nil"] = { formatting = { command = { "alejandra" } } }, + settings = { + ["nil"] = { formatting = { command = { "alejandra" } } }, + }, }, } @@ -55,10 +57,13 @@ vim.lsp.set_log_level("off") -- It is not recommended to break lspconfig into different settings -- related: https://github.com/neovim/nvim-lspconfig/issues/970#issuecomment-860080502 -for name, config in pairs(servers) do - require("lspconfig")[name].setup { +for name, user_config in pairs(servers) do + local default_config = { capabilities = mylsp.capabilities, - settings = config, + settings = user_config, on_attach = function(client, bufno) mylsp.on_attach(client, bufno) end, } + local merged_config = vim.tbl_deep_extend("force", default_config, user_config) + + require("lspconfig")[name].setup(merged_config) end