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
Hmm, I just tried using Reveal with Calva today
Worked fine, I did what you did: started nrepl in terminal and connected to it with Calva
Any exceptions somewhere?
I just checked Calva’s logs but don’t see any exceptions.
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.
Btw, no exceptions in the nrepl session output either.
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.
what's your reveal
alias?
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)This is my reveal alias:
{:reveal {:extra-deps {vlaaad/reveal {:mvn/version "1.0.130"}
nrepl/nrepl {:mvn/version "0.8.2"}}}}
let me try with nrepl 0.6.0
0.8.2 also works for me
I don't know about shortcuts, but I used "calva: connect..." action where I needed to specify the port
and then "calva: evaluate current form"
yeah the shortcuts I used match the commands you used
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
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.
It printed out this output when I evaluated my the whole core.clj
file.
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."
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
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]}]
(I'm talking about these kinds of forms that appear from time to time)
I guess calva tries to require clj-kondo for some reason
can you try in empty project?
sure
Same behavior. It prints that (try (clojure.lang.Compiler/load …
output.
Let me see what happens if I add clj-kondo to the deps
Added clj-kondo dep, I don’t see that output anymore, but I’m getting the same behavior as before.
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}
I’ll keep digging tomorrow and keep you posted.
Thanks for the help!