Fork me on GitHub
#reveal
<
2020-10-22
>
Célio18:10:02

Hi, is anyone able to use Reveal with Calva? I was able to fire up an nrepl session with:

clj -A:reveal -m nrepl.cmdline --middleware '[vlaaad.reveal.nrepl/middleware]'
The Reveal shows up, then I’m able to connect to the nrepl session from Calva, but once I start evaluating code from Calva, I don’t see any output in the Reveal window except this:
*ns*
=> user

vlaaad19:10:49

Hmm, I just tried using Reveal with Calva today

vlaaad19:10:30

Worked fine, I did what you did: started nrepl in terminal and connected to it with Calva

vlaaad19:10:41

Any exceptions somewhere?

Célio19:10:57

I just checked Calva’s logs but don’t see any exceptions.

Célio19:10:03

I’m probably doing something wrong. When I eval e.g.: {:a 1} I can see the eval output coming out in the Calva repl output, but nothing comes out in the Reveal window.

Célio19:10:54

Btw, no exceptions in the nrepl session output either.

Célio19:10:16

Quick summary of the steps I took: 1. run clj -A:reveal -m nrepl.cmdline --middleware '[vlaaad.reveal.nrepl/middleware]' in the terminal 2. Check out the reveal window, it’s empty 3. Go to Calva and type ctrl+c ctrl+c 4. Select Clojure CLI as project type 5. Select the nrepl port 6. As soon as Calva connects, I see => user namespace appear in the output 7. Place the cursor on some form and type ctrl+enter 8. The eval result appears in Calva’s repl output, but nothing appears in the reveal window.

vlaaad19:10:53

what's your reveal alias?

vlaaad19:10:12

I started with this:

$ clj -Sdeps "{:deps {nrepl/nrepl {:mvn/version """"0.6.0""""} vlaaad/reveal {:mvn/version """"1.0.130""""}}}" -M -m nrepl.cmdline --middleware "[vlaaad.reveal.nrepl/middleware]"
(multiple quotes because it's powershell)

Célio19:10:06

This is my reveal alias:

{:reveal {:extra-deps {vlaaad/reveal {:mvn/version "1.0.130"}
                                 nrepl/nrepl {:mvn/version "0.8.2"}}}}

Célio19:10:02

let me try with nrepl 0.6.0

vlaaad19:10:15

0.8.2 also works for me

vlaaad19:10:00

I don't know about shortcuts, but I used "calva: connect..." action where I needed to specify the port

vlaaad19:10:35

and then "calva: evaluate current form"

Célio19:10:52

yeah the shortcuts I used match the commands you used

Célio19:10:42

ok I see something different in the reveal window:

(try
  (clojure.lang.Compiler/load 
   (java.io.StringReader. 
    ((clojure.core/deref 
      (clojure.core/deref 
       (var nrepl.middleware.load-file/file-contents))) 
     (quote 
      ["/Users/ccidral/lusa/tools/api-script/src/api_script/core.clj" G__7056]))) 
   "/Users/ccidral/lusa/tools/api-script/src/api_script/core.clj" "core.clj") 
  (finally 
    (clojure.core/swap! 
     (clojure.core/deref (var nrepl.middleware.load-file/file-contents)) 
     clojure.core/dissoc 
     (quote ["/Users/ccidral/lusa/tools/api-script/src/api_script/core.clj" G__7056]))))
=> nil

Célio19:10:56

I remember seeing this before, the first time I ran reveal with nrepl 0.8.2, and then I didn’t see it anymore. Now that I changed nrepl version to 0.6.0 this output appeared again.

Célio19:10:22

It printed out this output when I evaluated my the whole core.clj file.

Célio20:10:13

I right-clicked on that output and selected view:value. It shows a huge map, looks like some nrepl internal state. There’s an error in there:

"Could not locate clj_kondo/core__init.class, clj_kondo/core.clj or clj_kondo/core.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name."

vlaaad20:10:22

this kind of stuff is unavoidable with nrepl because there is no good way to tell in the nrepl if sent command is user-triggered evaluation or some tool is doing that

Célio20:10:06

some more context:

#'clojure.core/*e #reveal/error{:via [{
    :type java.io.FileNotFoundException
    :message "Could not locate clj_kondo/core__init.class, clj_kondo/core.clj or clj_kondo/core.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name."
    :at [clojure.lang.RT load "RT.java" 462]}]

vlaaad20:10:09

(I'm talking about these kinds of forms that appear from time to time)

vlaaad20:10:35

I guess calva tries to require clj-kondo for some reason

vlaaad20:10:32

can you try in empty project?

Célio20:10:39

Same behavior. It prints that (try (clojure.lang.Compiler/load … output.

Célio20:10:53

Let me see what happens if I add clj-kondo to the deps

Célio20:10:16

Added clj-kondo dep, I don’t see that output anymore, but I’m getting the same behavior as before.

Célio20:10:06

This is my deps.edn file:

{:aliases {:reveal {:extra-deps {vlaaad/reveal {:mvn/version "1.0.130"}
                                 nrepl/nrepl {:mvn/version "0.8.2"}
                                 clj-kondo/clj-kondo {:mvn/version "2020.10.10"}}}}}
And this is my src/empty_proj/core.clj file:
(ns empty-proj.core)

{:a 1}

Célio20:10:30

I’ll keep digging tomorrow and keep you posted.

Célio20:10:47

Thanks for the help!