Fork me on GitHub

Does anyone know why Cider no longer honors the :init-ns setting in the :dev profiles of my Leiningen projects when I jack in? This used to work, and if I open a repl in Leiningen directly, with no Cider involvement, it puts me in the namespaces I expect. But Cider now is only putting me in the user namespace, which means none of the convenience functions (like doc, etc.) are available, because Leiningen put them in the project’s configured initial namespace.

;; Connected to nREPL server - 
;; CIDER 0.21.0 (New York), nREPL 0.6.0
;; Clojure 1.10.0, Java 1.8.0_181


And my Leiningen version is 2.9.1.


@deep-symmetry can you help me reproduce the happy path? i've made a lein project fizzbuzz with fizzbuzz.core and in project.clj i put :init-ns fizzbuzz.core. Presumably if I do lein repl i end up in user with not CIDER involvement. I've tried lein versions 2.9.1, 2.8.1 and 2.7.1


The easiest way would probably be to point you at one of my Clojure repositories. Dysentery has the fewest external dependencies and exhibits the problem:


If I clone that repo, then run lein repl within it, I am placed in the dysentery.core namespace as expected. But if I use CIDER to jack in to the project, I am placed in a stunted user namespace instead.


Which version of Leon?


Ah it’s under repl options. Thanks. I’ll look after lunch


I was doing it top level


@deep-symmetry annoyingly, it works for me with lein 2.9.1 and using CIDER from master which is 0.22.0-snapshot. Can you try something for me? Change the welcome function in the project.clj file to

:welcome (do (println "dysentery loaded.")
             (println (.name *ns*))
             (System/exit 0))
and then run lein update-in :dependencies conj \[nrepl\ \"0.6.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.22.0-SNAPSHOT\"\] -- repl that for prints out its in the correct ns with CIDER loaded. I'm guessing it will be the same for you


if this tests pass, i'm thinking something other than main CIDER is doing this. do you have refactor in the mix? any other packages?


You are correct, that did print the correct namespace (and then the transport socket closed because of the System/exit invocation). Ok, I do have clj-refactor in the mix, and this would not be the first time it has caused me grief.


But I just uninstalled clj-refactor and I am still ending up in user when jacking in.


OK, I just un-pinned CIDER from melpa-stable, and I can confirm that the version from master has fixed this problem. Now I just have to decide if I want to risk staying on the bleeding edge, or wait until this gets a stable release.


And it still works with clj-refactor enabled. I guess I will try living on master for a while.


Thanks for the suggestions and help experimenting!