fix(java): repair Java debugger configuration and add run keymaps

- Fix debug bundles not being passed to JDTLS init_options
- Add on_attach callback to setup DAP after LSP attaches
- Remove broken manual Java DAP adapter (now handled by nvim-jdtls)
- Add java-debug-adapter and java-test to Mason ensure_installed
- Add new Java keymaps: debug, test, run (file/maven/gradle)
This commit is contained in:
Carlos Gutierrez
2026-01-10 22:27:02 -05:00
parent cd817820ca
commit 3940c92b48
4 changed files with 67 additions and 15 deletions

View File

@@ -77,7 +77,7 @@ return {
-- 🧠 Mason DAP
require("mason-nvim-dap").setup({
ensure_installed = { "js-debug-adapter", "firefox" },
ensure_installed = { "js-debug-adapter", "firefox", "javadbg", "javatest" },
automatic_setup = true,
})
@@ -140,18 +140,9 @@ return {
})
-- ☕ Java Debug Adapter
dap.adapters.java = function(callback)
callback({ type = "server", host = "127.0.0.1", port = { port } })
end
dap.configurations.java = {
{
name = "Attach to running Java process",
type = "java",
request = "attach",
hostName = "127.0.0.1",
port = { port },
},
}
-- Note: Java DAP is configured by nvim-jdtls in ftplugin/java.lua
-- via jdtls.setup_dap() which automatically sets up the adapter
-- The configurations are dynamically discovered from the project
-- 🧠 Node.js (NestJS / TypeScript) - Using js-debug-adapter
dap.adapters.node = {

View File

@@ -50,6 +50,8 @@ return {
"pylint",
"eslint_d",
"tree-sitter-cli", -- required for nvim-treesitter parser compilation
"java-debug-adapter", -- Java debugger
"java-test", -- Java test runner
},
})
end,