daveleroy / SublimeDebugger

Graphical Debugger for Sublime Text for debuggers that support the debug adapter protocol
MIT License
369 stars 42 forks source link

Java: debugging JUnit tests #180

Closed takase1121 closed 1 year ago

takase1121 commented 1 year ago

I can't figure out a way to debug a JUnit test. I use JUnit 5 as a standalone jar file and I can't figure out how to launch it.

I went and poke around nvim-jdtls' code to find that there's a command to get the appropriate JUnit test command to run (which you can later attach to) but I have no idea how that would work with sublime debugger.

Here's the relevant nvim-jdtls command:

https://github.com/mfussenegger/nvim-jdtls/blob/cc59c194b3c6371e940b8aba9146a068b8035dee/lua/jdtls.lua#L256-L267

LDAP commented 1 year ago

The Java Debug Adapter is special in that it requires communication with the LSP-side. There might be work necessary in LSP-jdtls in addition to support JUnit in Sublime Debugger.

LDAP commented 1 year ago

This was implemented in the latest LSP-jdtls release. However, something is currently broken in Debugger, see #204.

LDAP commented 1 year ago

Fixed with the latest release. This can be closed @daveleroy

appelgriebsch commented 1 year ago

hmmm still facing the issue when trying to run any kind of JUnit tests via LSP-jdtls with the debugger open...

Unable to start adapter: Unable to connect to LSP client (timed out)

Debugger: v0.9.3 LSP: v1.22.0 LSP-jdtls: v2.0.0

LDAP commented 1 year ago

Can you post your ST console log and LSP log?

daveleroy commented 1 year ago

This might just be timing out I think the timeout is something short like 2.5 seconds which could be increased

appelgriebsch commented 1 year ago

This might just be timing out I think the timeout is something short like 2.5 seconds which could be increased

Yeah, that sounds like it. Any hint how I can extend the timeout in my setup (just to cross check)?

LDAP commented 1 year ago

Open your Packages directory. Then edit this line https://github.com/daveleroy/sublime_debugger/blob/master/modules/adapters/util/lsp.py#L25 in the Debugger package. Then restart ST.