Fork me on GitHub
#nrepl
<
2018-08-05
>
pez11:08:49

@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.

bozhidar11:08:38

Both combos work fine for me.

bozhidar11:08:00

How are you starting the server? What exactly are the problems you’re running into?

pez11:08:10

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]}}}

bozhidar11:08:31

It’s piggieback - you need 0.3.8+

bozhidar11:08:50

And whatever the latest sidecar is.

pez11:08:59

I’ll try right away.

bozhidar11:08:07

As for nREPL - 0.4.4

pez11:08:33

Calva works a lot better with 0.4 than with latest contrib version, btw.

bozhidar11:08:33

I recall there was something wrong with 0.4.0, so it’s a bad idea to depend on it. The newer, the better.

pez11:08:04

0.3.8 is newest piggieback?

bozhidar11:08:24

And the first one to support nREPL 0.4. 🙂

pez11:08:42

Funny that it seemed to work with 0.3.5 and 0.4.0 then.

bozhidar11:08:52

Can’t imagine how - piggieback 0.3.5 had a hard dep on tools.nrepl, so nREPL 0.4 would not load such middleware 🙂

pez11:08:59

wow. maybe I still have something in project.clj…

pez11:08:19

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]}}}

bozhidar11:08:44

Crashes how?

bozhidar11:08:52

Ah, now I see.

bozhidar11:08:00

You’re using lein repl, right?

pez11:08:58

I do 😃

bozhidar11:08:49

Lein switched to nREPL only in master, otherwise if you stuck with the contrib one.

bozhidar11:08:25

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.

pez11:08:31

OK. Things work if I change to 0.18-SNAPSHOT

bozhidar11:08:47

Yep, because you’re back to tools.nrepl then…

bozhidar11:08:10

@pez See https://github.com/nrepl/lein-nrepl if you want to run 0.4 with lein

pez11:08:19

So the improvments in Calva behaviour was do to cider-nrepl, I guess

bozhidar11:08:39

likely so 🙂

pez11:08:41

For a CLI project 0.19 should work?

pez11:08:15

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.

bozhidar11:08:19

Yes, but please ignore it completely.

pez11:08:32

Ignore what?

bozhidar11:08:37

I created 0.19-snapshot just to experiment with nREPL 0.4.

bozhidar11:08:47

Eventually I just folded the work in 0.18.

bozhidar11:08:22

The version number is a bit misleading, but I needed a way to be able to distribute this to people willing to test it.

bozhidar11:08:48

Basically you can just add cider-nrepl 0.18-SNAPSHOT to the example for piggieback and everything will work just fine.

pez12:08:54

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.

pez12:08:39

I saw that in the lein-nrepl instructions you placed cider-nrepl in :dependencies and not in :plugins.

bozhidar12:08:21

Yes, that’s intentional.

pez12:08:38

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.

bozhidar12:08:08

The plugin simply overwrites Lein’s repl profile config, but when you’re not using lein repl you don’t want to do this.

bozhidar12:08:14

Very simply put - the plugin generates something like this section:

:repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}}

bozhidar12:08:33

(but populated with CIDER’s middlewares)

bozhidar12:08:57

> But notice that 0-19 does not work if I keep it in :plugins, but 0.18 does.

bozhidar12:08:32

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.

bozhidar12:08:47

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.

bozhidar12:08:24

This commit should make it clearer

pez12:08:25

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.

pez12:08:15

(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]}}

bozhidar12:08:19

For 0.18 it’s fine to stay as a plugin if you’re using it with tools.nrepl.

bozhidar12:08:40

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.

pez12:08:46

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.

bozhidar12:08:01

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.

bozhidar12:08:40

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.

bozhidar12:08:46

I guess I’ll have to list somewhere a note or two about all of this. 🙂