nvim/lsp: use newer lspconfig setup style

This commit is contained in:
Primrose 2025-10-04 11:11:41 +08:00
parent d86e3c989d
commit 366cb19a7c
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
2 changed files with 11 additions and 9 deletions

View file

@ -22,7 +22,7 @@
"nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" },
"nvim-dap": { "branch": "master", "commit": "40a8189b8a57664a1850b0823fdcb3ac95b9f635" },
"nvim-jdtls": { "branch": "master", "commit": "4d77ff02063cf88963d5cf10683ab1fd15d072de" },
"nvim-lspconfig": { "branch": "master", "commit": "463b16bd6a347a129367a7fd00ebcdd9442d9a96" },
"nvim-lspconfig": { "branch": "master", "commit": "b8c3630ce37dfbe51910b68785a71620b072c41a" },
"nvim-metals": { "branch": "main", "commit": "852b8aa60d8ca30e14ef9253ced91656e845cfb7" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "89ebe73cd2836db80a22d9748999ace0241917a5" },

View file

@ -91,12 +91,14 @@ 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, user_config in pairs(servers) do
if next(user_config) ~= nil then
local default_config = {
capabilities = mylsp.capabilities,
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)
vim.lsp.config(name, merged_config)
end
vim.lsp.enable(name)
end