From 6f16a07a4e0de8df463fd975f29315cd67c6b9b7 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Wed, 12 Jun 2024 04:03:43 -0500 Subject: [PATCH] refactor(nvim): improve `nvim-java` setup --- .../.config/nvim/lua/plugins/configs/lsp.lua | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/users/price/dots/.config/nvim/lua/plugins/configs/lsp.lua b/users/price/dots/.config/nvim/lua/plugins/configs/lsp.lua index 1aa6a2d7..7c158357 100644 --- a/users/price/dots/.config/nvim/lua/plugins/configs/lsp.lua +++ b/users/price/dots/.config/nvim/lua/plugins/configs/lsp.lua @@ -152,9 +152,6 @@ return { "Decodetalkers/csharpls-extended-lsp.nvim", { "williamboman/mason-lspconfig.nvim", - dependencies = { - "neovim/nvim-lspconfig", - }, opts = { automatic_installation = true, @@ -292,20 +289,36 @@ return { }, event = { "BufReadPre", "BufNewFile" }, config = function() - require("java").setup() + require("mason-lspconfig").setup({ + automatic_installation = true, + ensure_installed = { + "tsserver", + }, + handlers = { + ["jdtls"] = function() + require("java").setup({ + notifications = { + dap = false, + }, + }) + end, + }, + }) local lspconfig = require("lspconfig") + lspconfig.jdtls.setup({ capabilities = lsp_capabilities, on_attach = on_attach, - init_options = { - extendedClientCapabilities = { - -- Have to disable this to make jdtls actually show hovers lol - clientHoverProvider = false, - }, - }, + -- HACK: Have to define this to make jdtls show hovers, etc. + init_options = {}, settings = { java = { + completion = { + postfix = { + enabled = true, + }, + }, inlayHints = { parameterNames = { enabled = "all",