cider

A channel dedicated to the Clojure Interactive Development Environment that Rocks (aka CIDER). :cider:
oxalorg (Mitesh) 2021-03-28T19:42:12.083900Z

cide-jack-in-clj is not injecting the middlewares properly and I'm unable to figure out how to debug this. It's either blank or incomplete, but this happens only "sometimes". Here's a screenshot where I open two emacs, go to same project, and try to jack in. On the first try jack-in created this unexpected command (notice the missing middleware list)

;;  Startup: /usr/local/bin/clojure -Sdeps '{:deps {nrepl {:mvn/version "0.8.3"} refactor-nrepl {:mvn/version "2.5.0"} cider/cider-nrepl {:mvn/version "0.25.5"}}}' -m nrepl.cmdline --middleware '[]'
On the second try jack-in created this expected command
;;  Startup: /usr/local/bin/clojure -Sdeps '{:deps {nrepl {:mvn/version "0.8.3"} refactor-nrepl {:mvn/version "2.5.0"} cider/cider-nrepl {:mvn/version "0.25.5"}}}' -m nrepl.cmdline --middleware '["refactor-nrepl.middleware/wrap-refactor","cider.nrepl/cider-middleware"]'
Everything else is exactly the same. The project consists of a blank clojure file with ns, with a blank deps.edn. But I face this issue about once a day. Any hints on how should I try to debug this? Could this be an issue due to clojure-lsp? Any help would be super appreciated 🙌

blak3mill3r 2021-03-28T20:37:18.086Z

That's mysterious. I wonder if there's something in your user ~/.clojure/deps.edn that is causing this. I suggest commenting out everything there and see if cider-jack-in-clj works.

blak3mill3r 2021-03-28T20:37:23.086200Z

@mitesh

blak3mill3r 2021-03-28T20:38:12.086900Z

also there is a file called ~/.nrepl/nrepl.edn that can configure the nrepl middleware, if it is there

blak3mill3r 2021-03-28T20:38:51.087700Z

and possibly take precedence over cider's ... maybe ... I would hope that the --middleware CLI option would take precedence there but check if you have that nrepl.edn file

dpsutton 2021-03-28T20:47:23.089900Z

its none of that. the startup command is emitted from vars in emacs. what ultimately is resolved at runtime might include those config files that but that literal string is constructed looking solely at emacs vars. The function doing all of this is cider-clojure-cli-jack-in-dependencies and you can see that the middleware is from (cider-jack-in-normalized-nrepl-middlewares). Evaluating just this should help you check this faster than waiting on all of the jvm startup. Everything is sourced from a variable called cider-jack-in-nrepl-middlewares. If that is set you should be good to go, otherwise it will be empty.

✔️ 1
dpsutton 2021-03-28T20:48:08.090400Z

I would look in your init or any dir locals files that might set this variable

ericdallo 2021-03-28T21:26:13.090500Z

I can guarantee that clojure-lsp has nothing related with a REPL issue 🙂 clojure-lsp is static analysis, nothing related with REPL

👍 1
🙌 1
oxalorg (Mitesh) 2021-03-28T21:49:51.090900Z

Thank you! I was a bit suspicious because clojure-lsp was the most recent change I had made to my config. BTW love using clojure-lsp thanks for all your work!! 🙌

❤️ 1
oxalorg (Mitesh) 2021-03-28T21:51:16.092600Z

Yes I don't think those files are the problem here. I've tried to inspect the cider-jack-in-nrepl-middlewares variable and that is empty whenever this jack-in command misbehaves. But the problem is figuring out why is it empty only sometimes? :thinking_face: This happens even when there are no .dir-locals.el file so that can't be the problem

oxalorg (Mitesh) 2021-03-28T21:54:31.095200Z

Also like I said if this were a configuration problem it should have been reproducible consistently, i.e. the middlewares should always have been empty. What I'm thinking is that maybe switching between multiple-projects somehow messes up the cider-jack-in-nrepl-middlewares state?

dpsutton 2021-03-28T21:55:34.095700Z

It never has for me. This smells like local shenanigans

✔️ 1
1
oxalorg (Mitesh) 2021-03-28T22:00:51.095900Z

Thanks for the help! I'll try to somehow reproduce the issue properly. 🙂

oxalorg (Mitesh) 2021-03-28T22:01:36.096100Z

It most definitely does look like an issue from my end rather than from CIDERs end!