From d3657e638cf7851c7be3597f5e98412d02ba89eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Tue, 24 May 2022 19:47:24 +0200 Subject: [PATCH] nvim(lsp): use nvim-lsp-installer for jdtls --- .../nvim/lua/esensar/lsp/jdtls_setup.lua | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/symlinks/config/nvim/lua/esensar/lsp/jdtls_setup.lua b/symlinks/config/nvim/lua/esensar/lsp/jdtls_setup.lua index 7bd8738..f05c260 100644 --- a/symlinks/config/nvim/lua/esensar/lsp/jdtls_setup.lua +++ b/symlinks/config/nvim/lua/esensar/lsp/jdtls_setup.lua @@ -6,28 +6,20 @@ local common_config = require("esensar.lsp.server_config") local M = {} function M.setup() - require("jdtls").setup_dap() - require("jdtls.setup").add_commands() - local on_attach = function(client, bufnr) - common_config.on_attach(client, bufnr) + local _, installed_jdtls = require("nvim-lsp-installer.servers").get_server("jdtls") - local opts = { buffer = bufnr } - local code_action_fun = function() - require("jdtls").code_action() - end - vim.keymap.set("n", "", code_action_fun, opts) - vim.keymap.set("n", "ac", code_action_fun, opts) - end + require("jdtls").setup_dap({ hotcoredeplace = "auto" }) + require("jdtls.setup").add_commands() local root_markers = { "gradlew", "pom.xml" } local root_dir = require("jdtls.setup").find_root(root_markers) - local config = { + local config = vim.tbl_extend("force", installed_jdtls["_default_options"], { flags = { allow_incremental_sync = true, }, - on_attach = on_attach, - } + on_attach = common_config.on_attach, + }) config.settings = { java = { signatureHelp = { enabled = true }, @@ -39,7 +31,6 @@ function M.setup() }, }, } - config.cmd = { "jdtls" } config.root_dir = root_dir config.on_init = function(client, _) client.notify("workspace/didChangeConfiguration", { settings = config.settings })