@bozhidar what is the closest to bleeding edge combo of cider-nrepl and nrepl I can use? I tried 0.19-SNAPSHOT with 0.4.4 and that wouldn’t work. Then tried 0.18-SNAPSHOT with 0.4.0 and that seems to work swell.
Both combos work fine for me.
How are you starting the server? What exactly are the problems you’re running into?
It is a small figwheel project that I use when hacking on Calva. I have placed all tooling dependencies in profiles.clj
. This works:
{:repl {:plugins [[cider/cider-nrepl "0.18.0-SNAPSHOT"]]
:dependencies [[nrepl "0.4.0"]
[cider/piggieback "0.3.5"]
[figwheel-sidecar "0.5.16"]]
:repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}}
It’s piggieback - you need 0.3.8+
And whatever the latest sidecar is.
I’ll try right away.
As for nREPL - 0.4.4
Calva works a lot better with 0.4 than with latest contrib version, btw.
I recall there was something wrong with 0.4.0, so it’s a bad idea to depend on it. The newer, the better.
0.3.8 is newest piggieback?
Yes.
And the first one to support nREPL 0.4. 🙂
Funny that it seemed to work with 0.3.5 and 0.4.0 then.
seem*s*
Can’t imagine how - piggieback 0.3.5 had a hard dep on tools.nrepl, so nREPL 0.4 would not load such middleware 🙂
wow. maybe I still have something in project.clj…
This crashes:
{:repl {:plugins [[cider/cider-nrepl "0.19.0-SNAPSHOT"]]
:dependencies [[nrepl "0.4.4"]
[cider/piggieback "0.3.8"]
[figwheel-sidecar "0.5.17-SNAPSHOT"]]
:repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}}
Crashes how?
Ah, now I see.
You’re using lein repl
, right?
I do 😃
Lein switched to nREPL only in master
, otherwise if you stuck with the contrib one.
The nREPL dep you’ve added is completely ignored and cider-nrepl 0.19 has a hard dep on nREPL 0.4, which I removed in 0.18.
OK. Things work if I change to 0.18-SNAPSHOT
Yep, because you’re back to tools.nrepl then…
I see
@pez See https://github.com/nrepl/lein-nrepl if you want to run 0.4 with lein
So the improvments in Calva behaviour was do to cider-nrepl, I guess
likely so 🙂
For a CLI project 0.19 should work?
I want to write as simple instructions to Calva users as possible. Calva does not yet start the repls and inject stuff so people have to fiddle with these dependencies still.
Yes, but please ignore it completely.
Ignore what?
I created 0.19-snapshot just to experiment with nREPL 0.4.
Eventually I just folded the work in 0.18.
The version number is a bit misleading, but I needed a way to be able to distribute this to people willing to test it.
See the CLI instructions here http://nrepl.readthedocs.io/en/latest/usage/
Basically you can just add cider-nrepl 0.18-SNAPSHOT to the example for piggieback and everything will work just fine.
I am bad at ignoring things 😃 Can confirm that 0.19 didn’t crash things at startup if using the latest lein-nrepl plugin. But some Calva features stopped to work.
I saw that in the lein-nrepl instructions you placed cider-nrepl in :dependencies
and not in :plugins
.
Yes, that’s intentional.
I am not sure what the difference is. But notice that 0-19 does not work if I keep it in :plugins
, but 0.18 does.
The plugin simply overwrites Lein’s repl
profile config, but when you’re not using lein repl
you don’t want to do this.
Very simply put - the plugin generates something like this section:
:repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}}
(but populated with CIDER’s middlewares)
> But notice that 0-19 does not work if I keep it in :plugins
, but 0.18 does.
0.19 doesn’t work because it generates the config, but as Lein is running an incompatible version of nREPL it can’t understand the config.
0.18 on the other hand checks to see if you’re running the old nREPL and uses it API if that’s the case, otherwise it switches to the new one’s API.
This commit should make it clearer
https://github.com/clojure-emacs/cider-nrepl/commit/15d87747f790d300b0f13eef2e5bdc87b9dfd4ec
Also, if I move 0.18 to :dependencies
the repl starts nicely, but some Calva features stop to work. They work if I keep 0.18 in :plugins
.
(Full profile):
{:plugins [[nrepl/lein-nrepl "0.1.1"]]
:dependencies [[cider/cider-nrepl "0.18.0-SNAPSHOT"]
[nrepl "0.4.4"]
[cider/piggieback "0.3.8"]
[figwheel-sidecar "0.5.17-SNAPSHOT"]]
:repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}
For 0.18 it’s fine to stay as a plugin if you’re using it with tools.nrepl
.
And as lein nrepl
doesn’t care about the lein repl
config it won’t be affected negatively by a cider-nrepl used as a plugin, either.
I’ll do that then, since that’s the config that works. Can I ask for advice about what to instruct Calva users to use? It might be a bit confusing with the above profile, since tools.nrepl will be used anyway, but it seems apt to prepare things for when it is time to move to nrepl.
Generally they can just keep using lein repl
like before for a while, so for now you don’t really need to change any instructions. Changes are needed only people using the cli.
For users of the cli - it’s best to suggest the creation of some profile similar to the one described in nREPLs docs. Then it’s important to be careful with the versions of all deps.
I guess I’ll have to list somewhere a note or two about all of this. 🙂