Fork me on GitHub
#calva
<
2022-01-12
>
agold00:01:01

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]
nil
"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?

bringe03:01:17

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

agold19:01:25

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]
nil
cljs.user=> hello
So it seems that there is an issue with Calva's repl. Any thoughts, @U9A1RLFNV @U0ETXRFEW?

bringe21:01:36

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

agold19:01:20

I made a minimal repro and filed an issue: https://github.com/BetterThanTomorrow/calva/issues/1468

❤️ 1
agold12:01:06

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?

pez12:01:30

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”.

pez12:01:50

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

😃 1
pez08:01:30

Alright, so the issue (https://github.com/BetterThanTomorrow/calva/issues/1468) has new updates and at least we have a workaround.

😔 1
pinkfrog11:01:40

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

pinkfrog11:01:23

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

pez14:01:23

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

thanks3 1
bringe03:01:02

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

pez09:01:26

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

👍 1
pinkfrog15:01:08

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

pez16:01:23

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

pinkfrog10:01:08

Thanks guys!

👍 2
cpmcdaniel21:01:21

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

bringe03:01:08

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): https://calva.io/clojure-lsp/#troubleshooting

bringe04:01:05

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.

bringe04:01:25

@U01EB0V3H39 Do you know if it works for you?

bringe04:01:56

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.

cpmcdaniel15:01:34

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

cpmcdaniel15:01:35

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

cpmcdaniel15:01:10

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

bringe16:01:30

@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.