Thursday, February 2, 2023

Clojurescript with Reveal & VSCode

So my next foray was into getting Reveal to work with Clojurescript (specifically Shadow-CLJS) and VSCode and Leiningen.

After a number of attempts, I got this sequence to work:

    1. Put in this line into shadow-cljs.edn
      1. :prepl {:app 12345}
    2. Jack-in via Calva using the Clojurescript configuration. This will launch npx shadow-cljs watch app
      1. This should build the clojurescript and watch for any changes.
    3. Then in a separate terminal window, run:
clj -Sdeps '{:deps {vlaaad/reveal {:mvn/version "1.3.278"}}}' -X vlaaad.reveal/remote-prepl :always-on-top true :port 12345

                This is from: :Cursive + Clj + remote pREPL 

                Note that the ports in Steps 1 & 3 need to match.

This brought up an empty Reveal window which you can see below; The only thing is there's no prompt so I didn't know if the damn thing worked! This is where I kept killing windows and retrying things! But actually, it works!




You can actually type a command in the top window even though there's no prompt and it will show up in Reveal!





    • Next, go to the website in the browser and hard refresh so that it pulls down the latest/greatest CLJS. (It may complain otherwise)
    • But now you can use (in-ns <name_of_namespace>) command to switch over and start examining things in Reveal.
    • Note that you can also use VSCode/Calva to execute expressions in the REPL but it won't appear in Reveal.
    • So the downside is that you'll have to switch back and forth...


Clojurescript with Reveal & VSCode

So my next foray was into getting Reveal to work with Clojurescript ( specifically Shadow-CLJS)  and VSCode and Leiningen. After a number of...