Fork me on GitHub

@stefan.van.den.oord, version v2.0.113 should fix the issue you ran into.


That’s wonderful @pez ! I was still planning to submit the issue but it was quite busy the last few days, finishing up before my holiday. So I guess I won’t have to submit it anymore :) I’ll verify it soon and let you know!


Someone else submitted the issue. 😃


And @UTF99QP7V ran into it as well. I'm sorry for the messup.

🤷 3

@pez I just updated to 2.0.113 and indeed the issue with continuously rerunning the tests is resolved. The other issue that I mentioned is not, however, so I created a ticket for it: It boils down to the REPL window grabbing focus when I have a compile error, which hides my editor window, which is annoying 🙂


Have something changed with repl and keyboard shortcuts in the latest Calva update? I don't see the results of evaluation any longer : (


Depends on what you mean with the latest Calva. Things have changed, alright. But you should still be able to see your evaluation results. Can you describe the failing steps a bit?


@pez Sure. When evaluating the result a new window is opening, output.repl-file, instead of the usual repl window. which is ok i guess as I've been using inline results for a while now. But occasionally the shortcut stops evaluating anything, not inline nor in the new output window. I have to re-connect the repl to revive it.


interestingly I can evaluate to the repl window when inline not longer working


i'm connecting to nrepl outside of the project, in case it matters


That doesn't matter. But very strange symptoms that. Which shortcut are you using?


evaluate top level form


I guess I found it: once I evaluate a form suspends the repl so that I need to interrupt it the output.repl evaluation won't work any longer and i need to reconnect.


You interrupt it using the Calva command for that?


Yes. It doesn’t help though as with the normal repl, I have to reconnect to nrepl every time


@pez I have a question about formatting. Given this form:

      (= list1 list2) :equal
      (some #{list2} parts-of-1) :superlist
      (some #{list1} parts-of-2) :sublist
      :else :unequal)
Is Calva able to format it like this?
      (= list1 list2)            :equal
      (some #{list2} parts-of-1) :superlist
      (some #{list1} parts-of-2) :sublist
      :else                      :unequal)
In other words: align the “right-hand side” in a column?


No, I don't think cljfmt has that option yet.

👍 3
Jack Arrington17:08:09

I have a REPL-driven development question. I'm a total beginner to this workflow so apologies if it is basic. Say I have some code like this:

;; a function
(defn f1 [arg] ( something...))

;; another function which depends on f1
(defn f2 [arg]
  (let [result (f1 arg)]
    ( something with result...))
Then I want to test f2, so I write an expression and evaluate it with ctrl+enter:
(f2 whatever-value)
But then I get an error because f2 is undefined, so I have to go back and eval it, then I get an error because f1 is undefined, so I have to go back and eval it too, before finally going back down and evaluating my test expression. If I find something wrong and want to change something in either function, I have to repeat the whole cycle by re-evaluating the function I changed and the test expression all over again. Is there not some more efficient way to do this, that would allow me to just eval my test expression and have it automatically use the latest versions of everything it references?

Ruy Valle17:08:12

I am also relatively new to Calva and Clojure so take what I say with a grain of salt. I use ctrl+alt+c followed by either ctrl+alt+space or just space and it uses the latest version I’ve evaluated. I don’t know if there’s a difference with ctrl+enter.

Ruy Valle18:08:04

In your case I would eval f1, then f2 and then my test expression and then if I update f2 I eval it again and then eval my test expression and I don’t have to eval f1 a second time.


@U015GL869TQ since recently alt+enter was added as a shortcut doing the same as the one you mention there.

Jack Arrington18:08:55

I was searching the docs for what ctrl+alt+c, space did and I think I might have answered my own question by finding the ctrl+alt+c, enter command (load current file) anc ctrl+alt+c, ctrl+alt+n (load current namespace). Though I'm confused why the load current namespace opens a new CLJS REPL, separate from the output.repl-file :thinking_face:


Load current namespace in repl window is a remnant of the old repl window that we're in the process of phasing out. I believe this needs to be changed to use the new repl-window. Right @pez?


@U0174QDHXV3 But yes, load current file will eval everything in the file. You can also enable the calva setting Eval on save , but either way you must press some key combo (ctrl+s to save or the load current file shortcut) to have your latest changes loaded into the repl.


I commonly will make a change and then load the file with ctrl+alt+c enter

Jack Arrington18:08:55

Awesome, yeah that workflow makes a lot more sense to me. Thanks for the help


Be careful with top level code though. Use the comment form to house your test expressions and playground code. I commonly have one of these at the bottom of the ns/file for testing things out as I go


No problem!

bringe18:08:45 This doc explains that workflow some


And the "See also" links on that page may be helpful to you

👍 3

I think it is healthy to get used to evaluating things form by form. If something else is evaluating my forms, I am not in control, so to speak.


hey everyone i am using luminus and just upgraded calva. im getting the following in the new repl window


; Hooking up nREPL sessions...
; Connected session: clj
; TIPS: You can edit the contents here. Use it as a REPL if you like.
;   Use `alt+enter` to evaluate the current top level form.
;   (`ctrl+enter` evaluates the current form.)
;   File URLs in stacktrace frames are peekable and clickable.
; Debugger initialized
; Evaluating 'afterCLJReplJackInCode'
; Syntax error compiling at (.calva/output-window/output.repl-file:14:1).
; Unable to resolve symbol: start in this context
[{:file "" :line 6808 :method "analyze" :flags [:tooling :java]}
 {:file "" :line 6745 :method "analyze" :flags [:dup :tooling :java]}
 {:file "" :line 3820 :method "parse" :flags [:tooling :java]}
 {:file "" :line 7109 :method "analyzeSeq" :flags [:tooling :java]}
 {:file "" :line 6789 :method "analyze" :flags [:tooling :java]}
 {:file "" :line 6745 :method "analyze" :flags [:dup :tooling :java]}
 {:file "" :line 6120 :method "parse" :flags [:tooling :java]}
 {:file "" :line 5467 :method "parse" :flags [:tooling :java]}
 {:file "" :line 4029 :method "parse" :flags [:tooling :java]}
 {:file "" :line 7105 :method "analyzeSeq" :flags [:tooling :java]}
 {:file "" :line 6789 :method "analyze" :flags [:tooling :java]}
 {:file "" :line 7174 :method "eval" :flags [:tooling :java]}
 {:file "" :line 7132 :method "eval" :flags [:dup :tooling :java]}
 {:file "jar:file:/home/canti/.m2/repository/org/clojure/clojure/1.10.1/clojure-1.10.1.jar!/clojure/core.clj:3214" :fn "eval"  :method "invokeStatic" :flags [:clj]}
 {:file "jar:file:/home/canti/.m2/repository/org/clojure/clojure/1.10.1/clojure-1.10.1.jar!/clojure/core.clj:3210" :fn "eval"  :method "invoke" :flags [:clj]}
 {:file "jar:file:/home/canti/.m2/repository/nrepl/nrepl/0.7.0/nrepl-0.7.0.jar!/nrepl/middleware/interruptible_eval.clj:91" :fn "evaluate/fn"  :method "invoke" :flags [:tooling :clj]}
 {:file "jar:file:/home/canti/.m2/repository/org/clojure/clojure/1.10.1/clojure-1.10.1.jar!/clojure/main.clj:437" :fn "repl/read-eval-print/fn"  :method "invoke" :flags [:clj]}
 {:file "jar:file:/home/canti/.m2/repository/org/clojure/clojure/1.10.1/clojure-1.10.1.jar!/clojure/main.clj:437" :fn "repl/read-eval-print"  :method "invoke" :flags [:dup :clj]}
 {:file "jar:file:/home/canti/.m2/repository/org/clojure/clojure/1.10.1/clojure-1.10.1.jar!/clojure/main.clj:458" :fn "repl/fn"  :method "invoke" :flags [:clj]}
 {:file "jar:file:/home/canti/.m2/repository/org/clojure/clojure/1.10.1/clojure-1.10.1.jar!/clojure/main.clj:458" :fn "repl"  :method "invokeStatic" :flags [:dup :clj]}
 {:file "jar:file:/home/canti/.m2/repository/org/clojure/clojure/1.10.1/clojure-1.10.1.jar!/clojure/main.clj:368" :fn "repl"  :method "doInvoke" :flags [:clj]}
 {:file "" :line 1523 :method "invoke" :flags [:java]}
 {:file "jar:file:/home/canti/.m2/repository/nrepl/nrepl/0.7.0/nrepl-0.7.0.jar!/nrepl/middleware/interruptible_eval.clj:84" :fn "evaluate"  :method "invokeStatic" :flags [:tooling :clj]}
 {:file "jar:file:/home/canti/.m2/repository/nrepl/nrepl/0.7.0/nrepl-0.7.0.jar!/nrepl/middleware/interruptible_eval.clj:56" :fn "evaluate"  :method "invoke" :flags [:tooling :clj]}
 {:file "jar:file:/home/canti/.m2/repository/nrepl/nrepl/0.7.0/nrepl-0.7.0.jar!/nrepl/middleware/interruptible_eval.clj:155" :fn "interruptible-eval/fn/fn"  :method "invoke" :flags [:tooling :clj]}
 {:file "" :line 22 :method "run" :flags [:java]}
 {:file "jar:file:/home/canti/.m2/repository/nrepl/nrepl/0.7.0/nrepl-0.7.0.jar!/nrepl/middleware/session.clj:190" :fn "session-exec/main-loop/fn"  :method "invoke" :flags [:tooling :clj]}
 {:file "jar:file:/home/canti/.m2/repository/nrepl/nrepl/0.7.0/nrepl-0.7.0.jar!/nrepl/middleware/session.clj:189" :fn "session-exec/main-loop"  :method "invoke" :flags [:tooling :clj]}
 {:file "" :line 22 :method "run" :flags [:java]}
 {:file "" :line 834 :method "run" :flags [:java]}]
; Evaluation failed.


has anyone encountered this type of output / error?


@tjb It looks like you need to require the namespace for start before calling it


prior to the calva changes, things would boot up with no issues


unsure how the upgrade has changed anything? so i am a bit lost 😞


You had that afterCLJReplJackInCode there before? I believe it does need to require a namespace before calling something in that namespace, i.e. (start)


i will be honest i am not sure. i am fairly new to clojure and when i created the luminus template there was an option to boot both the server + client up via a dropdown


then two repl windows would be created (prior to upgrade of calva)


Server + Client is what i used prior


Oh I see, yeah this should work "out of the box" - we need to look at this @pez


Thanks for reporting @tjb


i wish i am able to be more helpful but i am not sure what direction to debug in


If you don't mind, can you create an issue? Lots of things to keep track of right now. Best not to let things get lost in chat


Sure i can create on the github


Yeah, would be great


let me write it up and do my best to give as much detail as possible

💯 6

should i tag you in it?


np thank you!@


lmao i fixed it


"afterCLJReplJackInCode": "(user/start)",


Was that after code something you had added yourself to begin with or calva did?


so i generated a new lein project to be sure. the settings.json is the same with the function being called is (start)


that is what is auto generated


Ahhh... maybe we need to make calva require the user namespace before running the jack-in code then. Good find!

👍 3

if i modify to (user/start) it works as the proper namespace is used


np! glad i could help test and find stuff


wonder if i could maybe make a PR? might take me longer than others 😛


Please feel free!


ill give it a look to see if i can figure it out


It's pretty simple


dope! ill read this and fork the repo

calva 3

Just to point you in the right direction, see the function connectToHost in src/connector.ts


And a tip. The session objects have an eval function on them that allows you to eval some code in that nrepl session. In that function you will see a cljSession and also you will see where the afterCLJReplJackInCode code is evaluated


I'll leave it at that 😃


thank you bringe!


looking at the contribution guide i am a bit confused how to debug with Jack-in. when i go into debug mode i get No Jack-in possible


ah i got it 🙂 need to connect to the proper repl port

👍 3