Interrupting execution of a long-running (possibly infinite) is a very desirable feature that I would love to have in Calva.
Shooting for the moon here, but if execution could be interrupted and information about the context of interruption printed (ideally the call stack and super super desirably the values of locals in each stack frame), then that would be truly fabulous.
Rationale: Without this feature, any infinite loop cannot be stopped without entirely quitting and restarting VSCode, losing context, etc. To continue working it is necessary not only to be able to regain control of the REPL but also to terminate execution of the process so that it doesn't consume CPU cycles, drain batteries, etc.
This can be necessary both for accidental infinite loops and for intentional very-long-running processes that the developer realizes aren't doing what was intended, and have to be stopped and restarted after editing code.
@PEZ Isn't this now in the current version of Calva?
Indeed it is. Thanks to @cfehse !
How? I just started an infinite loop and don't see any way to interrupt it.
Sorry, I should have specified! In the REPL window, press ctrl+d to interrupt a running evaluation. In the editor, I believe you can interrupt with this command:

ctrl+d does not appear to do anything for me, when stuck in an infinite loop in the REPL window, whether I've actually entered the code in the REPL window or selected it in an editor window and used the command that evaluates a selection in the REPL window.
It would be great if whatever actually does work would be easily discoverable. Ideally the same method for interrupting a running evaluation would also work no matter how/where one started it.
Will have to check this out later. CC @cfehse @PEZ
@lspector Can you provide detailed reproduction steps (commands used, whether in editor or in REPL, etc)? That would be very helpful and much appreciated.
@bpinge:
(loop [] (println 'looping) (recur))ctrl-d, no effect, CPU cranking@lspector @bpringe
Yes that form creates intermediately 100% CPU utilization - so that nearly no keystroke gets through the message loop and the REPL window is constantly updating the output. Under this conditions no instantaneously interruption of the evaluations can be expected. If you are a bit patient and either close the REPL window (which will interrupt a running evaluation as well) or wait for the editor context menu or the command prompt to appear and then select there the Interrupt running Evaluations command the evaluation will be interrupted and CPU utilization will calm down quickly. My system was so busy that I wa even not able to record an animated GIF to show what's going on.
Try something less "brutal" like (while true (println "hello") (Thread/sleep 10)) and you see that the interruption works instantaneously if there are resources left on the system.
Thanks! This does work with the Interrupt running Evaluations command, even when I'm doing work in the loop rather than sleeping, as in:
(while true
(println (last (repeatedly 1000000 rand))))
However, ctrl-d doesn't seem to work in any case.
In any event, I agree this is a pretty good solution, once one knows about the interrupt command. I don't know if there's a way to make that more discoverable.
@lspector ctrl+d works fine in the REPL window, in case the REPL window is focused. During my testing I had no problems.
In any event, I agree this is a pretty good solution, once one knows about the interrupt command. I don't know if there's a way to make that more discoverable.
That's a general Problem with all the keyboard shortcuts I think. We introduced the editor context menu to get an idea, which commands are available and in the REPL window there is a list with important command in the intro section. This may be easily be overlooked.
Anyway I will close this issue for now.
Thanks for your testing!