From 2a619bac38b5505a8df6e28cd0dd144f67500c3e Mon Sep 17 00:00:00 2001 From: Delice0 <59118341+Delice0@users.noreply.github.com> Date: Sun, 19 May 2024 23:19:44 +0300 Subject: [PATCH] apply dpekta feedback items --- lua/lazyvim/plugins/extras/lang/java.lua | 27 ++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index 0bb1b9e4..d273d745 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -118,6 +118,15 @@ return { dap = { hotcodereplace = "auto", config_overrides = {} }, dap_main = {}, test = true, + settings = { + java = { + inlayHints = { + parameterNames = { + enabled = "all", + }, + }, + }, + }, } end, config = function() @@ -158,23 +167,11 @@ return { init_options = { bundles = bundles, }, + settings = opts.settings, -- enable CMP capabilities capabilities = LazyVim.has("cmp-nvim-lsp") and require("cmp_nvim_lsp").default_capabilities() or nil, }, opts.jdtls) - if opts.enableInlayHints == true then - local extendedClientCapabilities = require("jdtls").extendedClientCapabilities - - extend_or_override(config, { - extendedClientCapabilities = extendedClientCapabilities, - inlayHints = { - parameterNames = { - enabled = "all", - }, - }, - }) - end - -- Existing server will be reused if the root_dir matches. require("jdtls").start_or_attach(config) -- not need to require("jdtls.setup").add_commands(), start automatically adds commands @@ -195,6 +192,10 @@ return { callback = function(args) local client = vim.lsp.get_client_by_id(args.data.client_id) if client and client.name == "jdtls" then + -- INFO: without this the inlay hints start toggled off by default. + -- Maybe because `nvim-jdtls` attaches on a `FileType` event?? + -- Still with this the inlay hints are toggled on by default + LazyVim.toggle.inlay_hints(args.buf, true) local wk = require("which-key") wk.register({ ["cx"] = { name = "+extract" },