Nvim: Simplify the lsp configuration, add groovyls support
This commit is contained in:
@@ -6,30 +6,6 @@ endif
|
|||||||
lua << EOF
|
lua << EOF
|
||||||
local nvim_lsp = require'lspconfig'
|
local nvim_lsp = require'lspconfig'
|
||||||
|
|
||||||
nvim_lsp.ccls.setup {
|
|
||||||
init_options = {
|
|
||||||
compilationDatabaseDirectory = ".";
|
|
||||||
index = {
|
|
||||||
threads = 0;
|
|
||||||
};
|
|
||||||
clang = {
|
|
||||||
excludeArgs = { "-frounding-math"} ;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nvim_lsp.pylsp.setup{}
|
|
||||||
nvim_lsp.cmake.setup{}
|
|
||||||
nvim_lsp.rls.setup {
|
|
||||||
settings = {
|
|
||||||
rust = {
|
|
||||||
unstable_features = true,
|
|
||||||
build_on_save = false,
|
|
||||||
all_features = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Use an on_attach function to only map the following keys
|
-- Use an on_attach function to only map the following keys
|
||||||
-- after the language server attaches to the current buffer
|
-- after the language server attaches to the current buffer
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
@@ -77,9 +53,38 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
nvim_lsp.rls.setup {
|
||||||
|
settings = {
|
||||||
|
rust = {
|
||||||
|
unstable_features = true,
|
||||||
|
build_on_save = false,
|
||||||
|
all_features = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
nvim_lsp.groovyls.setup {
|
||||||
|
cmd = { "java", "-jar", "/home/kmcr/tools/groovy-language-server/build/libs/groovy-language-server-all.jar" },
|
||||||
|
on_attach = on_attach,
|
||||||
|
on_publish_diagnostics = diagnostic_handler
|
||||||
|
}
|
||||||
|
|
||||||
|
nvim_lsp.ccls.setup {
|
||||||
|
init_options = {
|
||||||
|
compilationDatabaseDirectory = ".";
|
||||||
|
index = {
|
||||||
|
threads = 0;
|
||||||
|
},
|
||||||
|
clang = {
|
||||||
|
excludeArgs = { "-frounding-math"} ;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
on_attach = on_attach,
|
||||||
|
on_publish_diagnostics = diagnostic_handler
|
||||||
|
}
|
||||||
|
|
||||||
-- 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 = { "pylsp", "rls", "cmake", 'ccls' }
|
local servers = { "pylsp", "cmake" }
|
||||||
for _, lsp in ipairs(servers) do
|
for _, lsp in ipairs(servers) do
|
||||||
nvim_lsp[lsp].setup {
|
nvim_lsp[lsp].setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
|
|||||||
Reference in New Issue
Block a user