Fork me on GitHub
#calva
<
2021-06-25
>
zimablue06:06:51

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 (?)

bringe19:06:24

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.

bringe19:06:29

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.

bringe19:06:58

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.

bringe19:06:29

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

bringe19:06:55

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.

zimablue03:06:04

thanks a lot for this help

zimablue03:06:11

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

zimablue03:06:08

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?

bringe23:06:33

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.

ericdallo20:06:54

That's awesome! 😄

☝️ 2
clojure-lsp 4