nvim: lsp: Refactor configuration setting for clients
This commit is contained in:
parent
223ffe7505
commit
ef00957fae
1 changed files with 40 additions and 49 deletions
|
@ -199,10 +199,10 @@ local rust_tool_opts = {
|
|||
},
|
||||
}
|
||||
|
||||
nvim_lsp.clangd.setup {
|
||||
on_init = on_init,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
require('rust-tools').setup(rust_tool_opts)
|
||||
|
||||
local servers = {
|
||||
clangd = {
|
||||
default_config = {
|
||||
cmd = { "clangd", "--background-index", "--pch-storage=memory", "--clang-tidy", "--suggest-missing-includes", "--header-insertion=never" },
|
||||
filetypes = { 'c', 'cpp' },
|
||||
|
@ -214,18 +214,10 @@ nvim_lsp.clangd.setup {
|
|||
return root_pattern(filename) or util.path.dirname(filename)
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
||||
nvim_lsp.hls.setup {
|
||||
on_init = on_init,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
nvim_lsp.jedi_language_server.setup {
|
||||
on_init = on_init,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
},
|
||||
eslint = {},
|
||||
hls = {},
|
||||
jedi_language_server = {
|
||||
init_options = {
|
||||
completion = {
|
||||
resolveEagerly = true,
|
||||
|
@ -239,18 +231,17 @@ nvim_lsp.jedi_language_server.setup {
|
|||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
tsserver = {},
|
||||
}
|
||||
|
||||
require('rust-tools').setup(rust_tool_opts)
|
||||
|
||||
nvim_lsp.tsserver.setup {
|
||||
on_init = on_init,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
nvim_lsp.eslint.setup {
|
||||
on_init = on_init,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
for client, config in pairs(servers) do
|
||||
config.on_init = on_init
|
||||
config.on_attach = on_attach
|
||||
config.capabilities = vim.tbl_deep_extend(
|
||||
'keep',
|
||||
config.capabilities or {},
|
||||
capabilities
|
||||
)
|
||||
nvim_lsp[client].setup(config)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue