Fork me on GitHub

I'm working on my first node project with Calva and shadow-cljs and do not understand why some output doesn't show up in the repl. For example:

(let [tn (js/setTimeout #(println "hello") 1000)]
    (println tn))

;; output
#object[Timeout 28348]
"hello" is not printed. But the corresponding js code in a node repl gives:
> setTimeout(()=>console.log("hello"), 1000)
Timeout {
  _idleTimeout: 1000,
  _idlePrev: [TimersList],
  _idleNext: [TimersList],
  _idleStart: 69189,
  _onTimeout: [Function (anonymous)],
  _timerArgs: undefined,
  _repeat: null,
  _destroyed: false,
  [Symbol(refed)]: true,
  [Symbol(kHasPrimitive)]: false,
  [Symbol(asyncId)]: 167,
  [Symbol(triggerId)]: 5
> hello
Is this the expected behavior? Is there a way to see the async output in the Calva repl?


With the first code snippet, do you see “hello” printed in the terminal that’s running the repl (not the output/repl window)?


Without Calva, the code works correctly, however:

❯ npx shadow-cljs node-repl
shadow-cljs - config: /Users/dan/projects/work/metabase/shadow-cljs.edn
shadow-cljs - connected to server

cljs.user=> shadow-cljs - #5 ready!

cljs.user=> (let [tn (js/setTimeout #(println "hello") 1000)]
    (println tn))
#object[Timeout 52]
cljs.user=> hello
So it seems that there is an issue with Calva's repl. Any thoughts, @U9A1RLFNV @U0ETXRFEW?


Let’s see if @U0ETXRFEW might know more about this. It could be caused by nrepl or by Calva’s handling of nrepl messages.


I made a minimal repro and filed an issue:

❤️ 1

In answer to this, @U05224H0W wrote: > The output of a `(shadow.cljs.devtools.api/node-repl)` is captured just as the regular CLJS node REPL. This is because the whole node process is managed and stdout/stderr can easily be captured. The `:node-script` build however does not capture that output because the user is in control of the `node` process. > This is expected and working as intended. If you must have all the output of a node REPL use the managed `node-repl`. The problem is that I don’t know how to “use the managed node-repl” in or out of Calva. Is there a custom jack-in command that can make this work in Calva?


I don't know what is meant by a ”managed node-repl”. Neither what it means that ”the user is in control of the node process”.


I commented on the issue now and hopefully we can get some clarifications from Thomas.

😃 1

Alright, so the issue ( has new updates and at least we have a workaround.

😔 1

Hi. Go to definition failed for Java libraries (both JDK and 3rd Java libs). Can some body confirm? Thanks


I’ve followed the instructions and have a running repl connected.


I also am having troubles with this. Don’t know what’s (not) going on.

thanks3 1

Jack-in deps were recently updated. It could be some change in cider-nrepl/orchard that broke something (just a guess).


I’ve experimented a bit with using the older versions, but it doesn’t seem to be about that.

👍 1

Knowing you guys are busy though. Sorry to ask, is this fix on the plan?


Yes. It is an important feature that we want to work well.


Thanks guys!

👍 2

My references tab doesn't seem to be working at all. Whenever I choose "Find all references" or "Open call hierarchy", it just looks like it is thinking and spins forever. Any clues or steps I should take to diagnose?

Lukas Domagala00:01:28

Do you have an open repl? Otherwise that information is coming from LSP


As far as call hierarchy, I think that only comes from clojure-lsp. Does clojure-lsp seem to be starting successfully? See here for info about troubleshooting (viewing messages between client/server and viewing the logs might help):


Thanks. We’ve upgraded the client library since then. I think it did work in the past. I’ll have to check it out soon, or someone else can verify that it works for them.


@U01EB0V3H39 Do you know if it works for you?


Actually I just checked and it seems to work

Lukas Domagala12:01:17

It works for me. I was thinking “Find all references” comes from nrepl once it’s running, but I didn’t check myself.


Call hierarchy was working and then started this behavior a few days ago


Oh, and it seems once I do Call Hierarchy, it breaks the Find All References until I restart


so looks like Call Hierarchy breakage is having side-effects on the others


@U0564EGNY Please create an issue and add details such as the clojure-lsp messages and logs from after you experience the issue. See the link I sent above for that.