-
-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot jack-in to deps.edn + shadow-cljs project #1307
Comments
I was unaware of this way to configure nREPL. |
There's some documentation on it here on the nREPL web site. |
Also, I noticed that the documentation explicitly states that CLI options override config file keys. Well, that's a bummer. |
Maybe Calva could check for that .nrepl.edn file, and if it exists, add the middleware from that config to what Calva wants to inject. It could be a naive solution, but I don't initially see it causing any major problems. I'm not sure what Calva currently does during jack-in and connect with this jack-in profile without looking at the code, but it could/should also call the |
This is probably not the same problem, but I paste it here so that we get a more complete view of this whole shenanigan. cider-jack-in-cljs clojure fails on shadow-cljs+deps.edn with "missing instance" |
This also looks like a duplicate or at least with the similar root cause as #1285. One issue being, that the shadow-cljs CLJS repl needs some more nRepl middleware (piggyback and shadow's own middleware). In an ideal world, Calva would use the dynamic middleware facility so that all jack-in commands start a plain nRepl session and then Calva would add needed middleware as needed. See https://lambdaisland.com/blog/2021-11-24-making-nrepl-cider-more-dynamic-2 for an example. The issue of actually having the dependencies on the classpath via sideloading (#1451) is related but also orthogonal to this, as since Calva is responsible for starting Clojure, it can pass in the deps as needed. |
Steps to reproduce
Have a project with
deps.edn
and shadow-cljs.Have
.nrepl.edn
in project root with this content:{:middleware [shadow.cljs.devtools.server.nrepl/middleware]}
In a terminal, start shadow-cljs watch:
In Calva, Run Start a project REPL and Connect.
Choose any deps.edn aliases.
Choose the shadow-cljs build ID whose watch you started (
:app
).Expected result
Can jack in.
Actual result
Get this error:
Additional information
No combination of custom connect sequences I attempted worked. Some yielded different errors.
Root cause?
Here's the jack in invocation Calva uses:
nREPL should pick up the shadow-cljs middleware from
.nrepl.edn
, but maybe the---middleware
setting overrides the middleware definition in.nrepl.edn
? Not sure.Workaround
In the terminal, run:
In Calva, add a custom connect sequence like this (
startCode
):In Calva, run Connect to a REPL server in project.
Choose "App" project type.
Only adding the shadow-cljs middleware into the middleware list doesn't work. If you try to start the shadow-cljs server/watch via
npx
and then connect, there's an error like this in the REPL view:Even though the server/watch is actually running.
The text was updated successfully, but these errors were encountered: