mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
nvim/lsp: allow setting all lsp config field in user config
This commit is contained in:
parent
c8fd1b4163
commit
ead40c844d
1 changed files with 9 additions and 4 deletions
|
|
@ -20,8 +20,10 @@ local servers = {
|
||||||
-- golangci_lint_ls = {},
|
-- golangci_lint_ls = {},
|
||||||
tinymist = {},
|
tinymist = {},
|
||||||
nil_ls = {
|
nil_ls = {
|
||||||
|
settings = {
|
||||||
["nil"] = { formatting = { command = { "alejandra" } } },
|
["nil"] = { formatting = { command = { "alejandra" } } },
|
||||||
},
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.diagnostic.config {
|
vim.diagnostic.config {
|
||||||
|
|
@ -55,10 +57,13 @@ vim.lsp.set_log_level("off")
|
||||||
|
|
||||||
-- It is not recommended to break lspconfig into different settings
|
-- It is not recommended to break lspconfig into different settings
|
||||||
-- related: https://github.com/neovim/nvim-lspconfig/issues/970#issuecomment-860080502
|
-- related: https://github.com/neovim/nvim-lspconfig/issues/970#issuecomment-860080502
|
||||||
for name, config in pairs(servers) do
|
for name, user_config in pairs(servers) do
|
||||||
require("lspconfig")[name].setup {
|
local default_config = {
|
||||||
capabilities = mylsp.capabilities,
|
capabilities = mylsp.capabilities,
|
||||||
settings = config,
|
settings = user_config,
|
||||||
on_attach = function(client, bufno) mylsp.on_attach(client, bufno) end,
|
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
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue