fix(dap): skip enrich_config for attach mode (#494) · nvim-java/nvim-java@ccd76f9 · GitHub
Skip to content

Commit ccd76f9

Browse files
fobbyalclaude
andauthored
fix(dap): skip enrich_config for attach mode (#494)
Setup:enrich_config asserts that mainClass is present, but attach configs don't have one and don't need one — the JVM is already running and chose its own main class, classpath, and java executable. The assert fires before any check on request type, making every attach config in nvim-dap fail unless callers pre-populate dummy values for the five fields the early-return checks. Adding an early return for `request == 'attach'` skips the launch-specific enrichment (build_workspace, classpath resolution, java executable resolution) which are all meaningless for an already- running JVM. Reproduction: register a Java attach config in dap.configurations.java with type='java', request='attach', hostName='127.0.0.1', port=5005, then :DapContinue. Today it errors with: To enrich the config, mainClass should already be present .../java-dap/setup.lua:54 After this fix, the attach proceeds and dap-ui opens against the running JVM as expected. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 602a5f7 commit ccd76f9

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

lua/java-dap/setup.lua

Lines changed: 8 additions & 0 deletions

0 commit comments

Comments
 (0)