From 86e58fd6cc55f08778f0721e5dc14b210a72d9be Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sun, 30 Jun 2024 11:36:40 -0500 Subject: [PATCH] perf(nvim): improve nvim-java lazy loading --- .../.config/nvim/lua/plugins/configs/lsp.lua | 100 ++++++++++++------ 1 file changed, 69 insertions(+), 31 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 cb19449c..af1bac4a 100644 --- a/users/price/dots/.config/nvim/lua/plugins/configs/lsp.lua +++ b/users/price/dots/.config/nvim/lua/plugins/configs/lsp.lua @@ -151,50 +151,88 @@ return { } end, }, + { + "williamboman/mason.nvim", + opts = { + max_concurrent_installers = 12, + registries = { + "github:nvim-java/mason-registry", + "github:mason-org/mason-registry", + }, + }, + cmd = { + "Mason", + "MasonLog", + "MasonUpdate", + "MasonInstall", + "MasonUninstall", + "MasonUninstallAll", + }, + }, + { + "nvim-java/nvim-java", + ft = { "java" }, + config = function() + require("lspconfig").jdtls.setup({ + capabilities = lsp_capabilities, + on_attach = on_attach, + -- HACK: Have to define this to make jdtls show hovers, etc. + init_options = {}, + settings = { + java = { + completion = { + postfix = { + enabled = true, + }, + }, + inlayHints = { + parameterNames = { + enabled = "all", + exclusions = { "this" }, + }, + }, + }, + }, + }) + end, + dependencies = { + "nvim-java/lua-async-await", + "nvim-java/nvim-java-refactor", + "nvim-java/nvim-java-core", + "nvim-java/nvim-java-test", + "nvim-java/nvim-java-dap", + "MunifTanjim/nui.nvim", + "mfussenegger/nvim-dap", + "williamboman/mason.nvim", + "neovim/nvim-lspconfig", + }, + }, { "neovim/nvim-lspconfig", dependencies = { + "williamboman/mason.nvim", "Decodetalkers/csharpls-extended-lsp.nvim", { "williamboman/mason-lspconfig.nvim", opts = { - automatic_installation = true, ensure_installed = { "tsserver", }, - }, - }, - { - "nvim-java/nvim-java", - dependencies = { - "nvim-java/lua-async-await", - "nvim-java/nvim-java-refactor", - "nvim-java/nvim-java-core", - "nvim-java/nvim-java-test", - "nvim-java/nvim-java-dap", - "MunifTanjim/nui.nvim", - "mfussenegger/nvim-dap", - "williamboman/mason.nvim", - }, - }, - { - "williamboman/mason.nvim", - opts = { - max_concurrent_installers = 12, - registries = { - "github:nvim-java/mason-registry", - "github:mason-org/mason-registry", + handlers = { + ["jdtls"] = function() + require("java").setup({ + -- Handled by $JAVA_HOME + jdk = { + auto_install = false, + }, + notifications = { + dap = false, + }, + }) + end, }, }, - cmd = { - "Mason", - "MasonLog", - "MasonUpdate", - "MasonInstall", - "MasonUninstall", - "MasonUninstallAll", - }, }, "Hoffs/omnisharp-extended-lsp.nvim", "b0o/schemastore.nvim",