Fork me on GitHub
#calva
<
2021-02-18
>
raicotop08:02:32

When I'm in REPL workflow and evaluate something that takes a long time (or infinite time) and I want to cancel the evaluation process, is there a better way than restarting the whole REPL?

pez08:02:50

@janpotociar there is a command named something like Interrupt running evaluations, that should probably work. Unless you have println s inside that loop, because the printing in the REPL window is slow and if the queue is long, you better just reload the vscode window. Also, I think I saw, somewhere, that @andy.fingerhut had made some article or video about considerations when interrupting evaluations (not Calva specific, I am sure, but sounded like something I will want to check up, and maybe you too now). Not sure where I read it though, maybe someone else knows what I am talking about. 😃

andy.fingerhut14:02:44

@pez Thanks for the PR on https://github.com/jafingerhut/dontstop. - I took it, and made a few more changes, after testing out with a fresh VS Code and Calva install on an Ubuntu Linux system (I had to change Ctrl-Alt-D in Ubuntu settings not to close all windows to test it). I saw a mention of also perhaps interrupting current form evaluation in Calva by typing Ctrl-D in the REPL window, but could not confirm that behavior. Which is the REPL window? The one where the lein ... command line is shown? The one called output.calva-repl? Some other window?

andy.fingerhut14:02:53

The implementation behavior is exactly the same as lein repl started in a terminal with the same version of nrepl, which is: if nrepl is 0.7.0 or later, the REPL prompt comes back quickly, and the thread has Thread#interrupt method called on it quickly, but if the thread still hasn't stopped by 5.1 sec later, then Thread#stop is called on it. Those details are in my article.

❤️ 1
pez16:02:02

You’re welcome, @andy.fingerhut. 😃 Maybe I had it confused that the editor needs to support cider-nrepl. Reading the article now, it looks like nrepl should be enough. I’ll test that and file a new PR if that is so. The REPL window is the editor pane where evaluation output is printed. (It is sometimes called the output window, sometimes repl window, sometime both… we should probably clean that up.).

pez16:02:36

Good to know about the ctrl+alt+d problem on Ubuntu. We should fix that default shortcut for linux. I’m on the run, but if someone else has a minute, please file an issue about it.

andy.fingerhut16:02:14

After starting of an infinite loop from one of my Clojure source files in a comment block, using the expression (def x1 (dorun (range))) (no output), I tried clicking in the pane titled output.calva-repl that earlier showed the results of evaluating expressions. I tried Ctrl-D, Ctrl-Alt-D, and Ctrl-C to see if any of those would interrupt the evaluation, but none of them did. Ctrl-Alt-C Ctrl-Alt-D did when typed in the REPL window, and also when typed from the pane with the Clojure source file with the expression that I evaluated.

andy.fingerhut16:02:32

It seems sufficient to me if there is just one way to interrupt evaluation, of course. I only mention trying the other keystrokes because I think I saw them mentioned in the Github comment discussion where someone was asking about how to do this in Calva.

pez16:02:10

Thanks. We'll fix it via the documentation. 😀

pez18:02:28

Calva friends: It’s been a while since I reminded you about joining the #startup-in-a-month channel. It’s a super exciting story developing there, with a brave man taking a Clojure leap of faith, and generously sharing his experiences with the rest of us. I hope you consider following along for at least parts of his journey and offer him that help that we Clojurians seem so extra capable of providing. I think it is going to be a story of great success of the kind you can reap only if you put in the hours, the sweat, and the tears that @andyfry01 does, with all that good humour he does it too.

👍 3
❤️ 2
afry19:02:12

Gees @pez, thank you! Calva makes it all possible, so thank you in turn for providing me with such a wonderful tool. Makes the sweat a little less salty, and the hours go by a little more quickly!

tbrooke19:02:11

I am trying to start a shadow-cljs repl - I make the selection to jack in then put my nrepl port number and then I get a choice of :app node-repl and browser-repl - all of the choices crash the repl. What do I do?

pez20:02:14

You shouldn't get a port number prompt when jacking in...

tbrooke22:02:31

When I start is says connecting to repl and it connects but I don’t think it is really connected. Here is a screenshot;

pez22:02:28

That looks like you have some other REPL extension installed as well, maybe the one just named Clojure?. That can get confusing. Try uninstalling that other one, and then use Calva’s command Start a REPL in your Project and Connect, (a k a Jack-in), and see if that works better.

tbrooke14:02:47

It looks like I have 2 repls running now - I Let the nrepl start on startup then I tried to connect to running repl using deps.edn +shadow.cljs - I get the following error: clj꞉user꞉>  ; Use alt+enter` to evaluate` ; Creating cljs repl session... ; Connecting cljs repl: deps.edn + shadow-cljs... ; The Calva Connection Log might have more connection progress information. ; Execution error (ClassNotFoundException) at .URLClassLoader/findClass (URLClassLoader.java:381). shadow.cljs.devtools.api ; Error while connecting cljs REPL: TypeError: Cannot read property 'search' of undefined

pez14:02:31

Hmmm, two things that might help resolve this. 1. Calva doesn’t have an option for starting the repl at startup. Maybe it had a long time ago, I seem to recall something like that. Check what extensions you have installed related to Clojure. If you have two Calva extensions, remove the one with the ugly logo. If you have the Clojure extension installed, you need to make a choice which one to use, at least per project. It will be confusing for you to know which one you are using. 2. For a deps.edn + shadow-cljs project you will need to configure dependencies and main aliases. There was some discussion about this in this channel not too long ago. Hopefully you can still find it if you search here on Slack. Otherwise the https://clojurians-log.clojureverse.org will have it. There is also some discussion in this issue: https://github.com/BetterThanTomorrow/calva/issues/1032