cider icon indicating copy to clipboard operation
cider copied to clipboard

Debugging and introspecting java code via dap-mode/lsp-java

Open yyoncho opened this issue 5 years ago • 14 comments

I am working on a new package dap-mode which is using Debug Adapter Protocol which currently supports debugging java. Here it is guide how it can be configured to debug java code when doing cider repl session: debug java (Edited) . I believe that it may be usefull for clojure programmer who are doing java interoperability programming.

Additionally, if cider provides information for the currenly executed line when the debugger is in clj source file it may be used to debug clojure source as well.

Debug session

yyoncho avatar Aug 19 '18 09:08 yyoncho

I am working on a new package dap-mode which is using Debug Adapter Protocol which currently supports debugging java. Here it is guide how it can be configured to debug java code when doing cider repl session: debug java . I believe that it may be usefull for clojure programmer who are doing java interoperability programming.

Looks cool! I guess we should mention this somewhere in the manual.

Additionally, if cider provides information for the currenly executed line when the debugger is in clj source file it may be used to debug clojure source as well.

What exactly do you need?

bbatsov avatar Aug 21 '18 21:08 bbatsov

@bbatsov

What exactly do you need?

as it is partially visible in the screenshot above(in the Sessions window), there are no lines for clj files(it displays No Source). If cider provides a way to get the location in the clj file for particular stack frame then the debugger would be able to step through CLJ files as well.

yyoncho avatar Sep 17 '18 11:09 yyoncho

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

stale[bot] avatar May 08 '19 17:05 stale[bot]

If cider provides a way to get the location in the clj file for particular stack frame then the debugger would be able to step through CLJ files as well.

That shouldn't be hard IMO. What should be the API for this?

bbatsov avatar May 10 '19 07:05 bbatsov

@yyoncho This looks really cool. Do you still plan to work on this?

jumarko avatar May 10 '19 12:05 jumarko

@jumarko yes, I am working on it, now it supports 10+ languages out of the box and it is part of emacs-lsp organization. Do you have something particular in mind?

@bbatsov I guess something like: (thread-name, stack-frame) -> (buffer-or-file-name, point) would be sufficient to support stepping through.

Apart from that, I think that debugging clojurescript is possible even now via FF/Chrome debuggers which since they accept sourcemaps.

PS: I live in Sofia so we have a beer and chat about emacs and maintaining open source projects(I am now maintaining lsp-mode as well).

yyoncho avatar May 10 '19 14:05 yyoncho

@bbatsov I guess something like: (thread-name, stack-frame) -> (buffer-or-file-name, point) would be sufficient to support stepping through.

Got it. @vspinu @Malabarba Would one of you be able to look into this?

PS: I live in Sofia so we have a beer and chat about emacs and maintaining open source projects(I am now maintaining lsp-mode as well).

Small world! I'd love to meet a fellow Bulgarian Emacser! Shoot me some email or something and we'll make it happen!

bbatsov avatar May 10 '19 14:05 bbatsov

I would love to have a look at this but unfortunately I am really having hard time figuring lsp/lsp-java machinery for now, let alone dap-java. But it's probably my problem.

@yyoncho your original guide link is empty. Would be really great if you could provide a minimal setup for how a cider/clojure user could delve into dap. Thanks!

vspinu avatar May 12 '19 12:05 vspinu

Here it is the proper link https://github.com/emacs-lsp/dap-mode/wiki/Clojure:-debugging-and-introspecting-Java-Code . I will create an emacs -q configuration.

yyoncho avatar May 12 '19 12:05 yyoncho

@yyoncho your original guide link is empty. Would be really great if you could provide a minimal setup for how a cider/clojure user could delve into dap. Thanks!

@vspinu is your issue sorted out now?

yyoncho avatar May 14 '19 15:05 yyoncho

Yes, thanks. I have figured out the lsp part. Things do work as expected. Nice. Next is dap, but it might take a few weeks till I am able to dwell properly into it. I am in a traveling mode now.

vspinu avatar May 15 '19 07:05 vspinu

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

stale[bot] avatar Aug 13 '19 07:08 stale[bot]

Bot, pls keep this open.

vspinu avatar Aug 15 '19 10:08 vspinu

Hey, any news on this issue? it would be really cool to have this feature

ericdallo avatar May 06 '20 14:05 ericdallo