This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-11
Channels
- # ai (1)
- # announcements (59)
- # aws (3)
- # babashka (16)
- # beginners (36)
- # calva (29)
- # cider (7)
- # clj-kondo (33)
- # clojure (77)
- # clojure-austin (1)
- # clojure-australia (4)
- # clojure-europe (16)
- # clojure-france (7)
- # clojure-nl (2)
- # clojure-spec (1)
- # clojure-sweden (8)
- # clojure-uk (4)
- # clojurescript (17)
- # cloverage (4)
- # conjure (2)
- # cursive (3)
- # datomic (22)
- # emacs (16)
- # fulcro (10)
- # graphql (3)
- # helix (13)
- # jobs (1)
- # kaocha (1)
- # lsp (7)
- # malli (1)
- # nextjournal (1)
- # off-topic (32)
- # pedestal (8)
- # polylith (5)
- # reitit (4)
- # reveal (1)
- # shadow-cljs (67)
- # spacemacs (7)
- # tools-deps (6)
- # xtdb (4)
I'm trying out for the first time Calva jack-in. What's the difference between a deps.edn + shadow-cljs
vs just shadow-cljs
? In my case the first one doesn't work (I get an error about unable to connect to the CLJS repl) whereas the second version works just fine.
But when I was starting the REPL outside of Calva, connecting via deps.clj + shadow-cljs
was the working one.
The difference is that the former will start the REPL using clojure
rather than with npx shadow-cljs
. I think it fails because we’re missing to inject the shadow devtools as a dependency.
Yeah it seems that when I start with the former, shadow-cljs builds are not started...
clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"0.9.0"},cider/cider-nrepl {:mvn/version,"0.27.4"}}}' -M:dev:cljs:i18n:test -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
this the jack-in command copied to the clipboard.
To get it to work with jack-in right now, you’ll need to have the shadow dependencies set up in some deps.edn alias. If I am correct that this is what is amiss.
I'm curious because I wanted to see how calva starts shadow-cljs builds from within a deps.edn file 🙂
Indeed, you said you had it working if you started it manually and connected… I don’t remember if we track this on github, but if we don’t, we should. My goldfish memory is far from enough.
I will continue exploring this, there seems to be a race condition somewhere in our code because both shadow and our system will load the same files. My goal would be to start via clojure
and then execute some code to start the desired shadow builds (but only after our project starts)
Looking further into it, shadow applies its own nrepl middleware (see https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/cljs/devtools/server/nrepl.clj and https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/cljs/devtools/server/nrepl_impl.clj)
So if you start nrepl outside of it (via a plain -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
command, that middleware isn't applied.
So given the complexity of that, the solution is to let shadow-cljs start nrepl for you (as it does by default) and not start nrepl via the nrepl.cmdline.
shadow-cljs will load the cider.nrepl/cider-middleware
if it's on the classpath though.
I will package all of this into an issue with a problem statement, sorry for the noise 🙂
I think it's relevant to this https://github.com/BetterThanTomorrow/calva/issues/1307 I will keep digging.
In the context of a Jack-in command, can I make Calva prompt me for extra deps to pass in? For example, I may want to sometimes use extra deps that come from my user deps.edn, but not always.
Jack-in should prompt you for aliases always. However, it does not read your user aliases, so you will need to configure those using a setting something.myAliases
(i’ve forgotten the prefix right now…)
Nice, that makes them show up on the menu, but in the context of a custom sequence (which is checked in to git to share with the team) I don't want to bake those in. So I'd like to e.g. press "shift-enter" on that UI and get the menu selection so I can check in an extra dependency...
Not a big deal, I'm the only user of Calva anyway so I can push those settings out to my user instead of the workspace, or I can add an extra custom sequence with a dependency to portal...