Fork me on GitHub

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 🙂


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,


oh ok let me try that 😄


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


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


thank you very much, you showed me the way 😄


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

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?


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 ""
         :port 5310
         :middleware [cider.nrepl/cider-middleware
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


Adjust accordingly for project.clj v deps.edn


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


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


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.


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.


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.


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


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


(for Lein at least)


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


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


Not sure why decided to do this differently.


> 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?


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.