From 11ccca80d9627c9b3787c434cf3820a1b7d2e85b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Kmie=C4=87?= Date: Tue, 27 Jul 2021 22:28:12 +0200 Subject: [PATCH] Nvim: Simplify the lsp configuration, add groovyls support --- .config/nvim/after/plugin/lspconfig.rc.vim | 55 ++++++++++++---------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/.config/nvim/after/plugin/lspconfig.rc.vim b/.config/nvim/after/plugin/lspconfig.rc.vim index e5d0574..4e1df71 100644 --- a/.config/nvim/after/plugin/lspconfig.rc.vim +++ b/.config/nvim/after/plugin/lspconfig.rc.vim @@ -6,30 +6,6 @@ endif lua << EOF 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 -- after the language server attaches to the current buffer 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 -- 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 nvim_lsp[lsp].setup { on_attach = on_attach,