Fork me on GitHub
#cider
<
2021-01-19
>
richiardiandrea01:01:58

Hi there! Is anybody using which-key by any chance? I am a newbie and I am wondering how I can see help for things like cider's C-c C-j for instance given C-x C-c closes the buffer 😄 Trying to understand how to use which-key mostly 🙂

AC01:01:25

which-key kicks in after a pause when entering a prefix. here’s a example of marking a sexp (using my custom bindings) and then inserting it into the repl,

richiardiandrea01:01:30

oh ok let me try that 😄

richiardiandrea01:01:35

cause C-c C-j C-x does not trigger it but C-c C-x does enter in it with the cider-start-map

richiardiandrea01:01:12

oh, this is magic, C-c C-j and I wait a little and now things appear 😄

richiardiandrea01:01:52

thank you very much, you showed me the way 😄

AC01:01:58

you can also configure the amount of delay with which-key-idle-delay. (the docs say you have to set it before starting which-key-mode)

👍 3
pez13:01:41

So, in a lein-figwheel project, with cider-jack-in-cljs, I expect the piggieback middleware to be injected. But it isn’t. Am I wrong expecting this? Or what could cause it to not be?

tvaughan14:01:52

In deps.edn:

:shadow {:extra-deps {binaryage/devtools {:mvn/version "1.0.2"}
                                 cider/cider-nrepl {:mvn/version "0.25.6"}
                                 cider/piggieback {:mvn/version "0.5.2"}
                                 refactor-nrepl/refactor-nrepl {:mvn/version "2.5.0"}
                                 thheller/shadow-cljs {:mvn/version "2.11.14"}}
                    :extra-paths ["test"]
                    :main-opts ["-m" "shadow.cljs.devtools.cli"]}
In shadow-cljs.edn:
:nrepl {:host "0.0.0.0"
         :port 5310
         :middleware [cider.nrepl/cider-middleware
                      cider.piggieback/wrap-cljs-repl
                      refactor-nrepl.middleware/wrap-refactor]}
I use cider-connect not cider-jack-in to use a cljs repl, so this may not be everything, but I'm assuming the problem is that piggieback isn't found on the classpath

tvaughan14:01:12

Adjust accordingly for project.clj v deps.edn

pez16:01:37

This is for jack-in so trying not to have those things specified in the project.

dpsutton15:01:03

It always is for me. Open an issue with a repro?

pez16:01:21

To clarify, the dependency is injected. But not the middleware. The middleware is added in a profile that I don’t use ( :figwheel). So I was thinking maybe CIDER sees the middleware there and refrains from injecting it. This all was not happening on my machine, but on a clooagues, over screensharing, so I couldn’t do the experiments that I would have done otherwise. And thus have too little context for a meaningful issue, I think.

bozhidar07:01:17

CIDER doesn't really check anything in the user configs and optimistically injects everything that's needed. The assumption was always that if someone tweaked their project config for some particular reason they probably know how to tweak CIDER's config as well.

pez07:01:21

That’s what Calva does too. Which brings me back to the question if I am wrong to expect to see the middleware injected? Calva adds this to the command line:

-- update-in '[:repl-options,:nrepl-middleware]' conj '["cider.piggieback/wrap-cljs-repl"]'
CIDER doesn’t, on my colleagues machine. So he has to add it to his global lein config or in the project. I can live with it added to the project, but I’d prefer not to have it there and rely on injection by the editors.

bozhidar07:01:47

I just tested this locally and the Piggieback injection works fine.

bozhidar07:01:03

That's the CIDER command line invocation - /home/bozhidar/bin/lein update-in :dependencies conj \[nrepl/nrepl\ \"0.8.3\"\] -- update-in :dependencies conj \[cider/piggieback\ \"0.5.2\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.25.5\"\] -- repl :headless :host localhost

bozhidar07:01:13

(for Lein at least)

bozhidar07:01:23

I have to check if it's some problem with tools.deps.

bozhidar07:01:10

For leiningen the middlewares get the added by the Lein plugin, as it's a bit simpler this way.

bozhidar07:01:31

Not sure why decided to do this differently.

pez07:01:42

> For leiningen the middlewares get the added by the Lein plugin, as it’s a bit simpler this way. So, the -- update-in :plugins conj \[cider/cider-nrepl\ \"0.25.5\"\] takes care of it?

pez07:01:13

The full Calva comand line in our project looks like so:

lein update-in :dependencies conj '[nrepl,"0.8.3"]' -- update-in :dependencies conj '[clj-kondo,"2020.04.05"]' -- update-in :dependencies conj '[cider/piggieback,"0.5.2"]' -- update-in :plugins conj '[cider/cider-nrepl,"0.25.6"]' -- update-in '[:repl-options,:nrepl-middleware]' conj '["cider.nrepl/cider-middleware"]' -- update-in '[:repl-options,:nrepl-middleware]' conj '["cider.piggieback/wrap-cljs-repl"]' -- with-profile +test,+dev,+script repl :headless
Maybe it is overkill, but it works. 😃 With CIDER we got some intermittent piggieback complaints, and I started to suspect that missing middleware injection, but then it is probably something else causing the friction.