Fork me on GitHub

hi, I am trying the calva debugger: is there any way to put in a breakpoint without re-evaluating the specific form? for example if I jack-in, AFAICT the only way to get a breakpoint into a function somewhere is to reevaluate that function with #break in it, having #break in the source at the time of jacking in doesn't seem to work (?)


Well, loading a file will clear the breakpoints if they were set, and will not set them if they weren't set. As far as I know, a file needs to be loaded directly or indirectly (from another file that requires the namespace) after jack-in before you can evaluate calls to functions in the file. At this point an evaluation of the function with a #break is necessary to set the breakpoint after the load-file operation.


So, I don't think it's possible to have the breakpoints work right after jack-in, without evaluating the function with #break(s) in it.


However, if you start your repl outside of VS Code and connect to it instead of using jack-in, you won't need to set the breakpoints again after reconnecting, provided they were still set from the last time you worked in that repl.


And you don't load the file after reconnecting, before trying to hit the breakpoints again.


An easy way to start a repl the same way as jack-in does is to run the command "Copy Jack-in Command to Clipboard" while your project is open, make the menu selections you would make for jack-in, then paste the command into a terminal outside of VS Code and run it. Then you can run the Calva command to connect to that repl each time you want to work in that project, provided you haven't closed that terminal or restarted your machine.


thanks a lot for this help


so what you're saying is if I understand: "no", but a workaround which can give a smoother workflow is to maintain a persistent REPL so that this calva-evaluation only has to happen once


is this a design choice or due to some limitation? Do other tools like Emacs or Calva allow loading a file with existing breakpoints and jumping straight in?


You're welcome. Yes, you understand correctly. Calva's debugger uses functionality from cider-nrepl, which Emacs/Cider uses, and I believe Cider has the same limitation.


That's awesome! 😄

☝️ 2
clojure-lsp 4