Ok, the solutions I think I found.... 1) I still don't know, but I saw when cider launches a repl it uses nrepl-cmdline which seems to be saving the port a file on the root of the project (.nrepl-port) https://github.com/nrepl/nrepl/blob/be37e0ebd13c2d341bf6a7bcd5735da45b78f909/src/clojure/nrepl/cmdline.clj#L403-L413
2) I thin figwheel launches a single nREPL server, the cmds to cljs or clj are "redirected" through the use of the piggieback middleware, so I shouldn't try to run two nREPLS
3) is basically answered by 2).. 🙂
founds this project that solved the cider-jack-in-clj&cljs
debacle for me: https://github.com/EmmanuelOga/deps-cider-cljs-reagent
the "secret sauce" seems to be the config on .dir-locals.el, which customize the way cider launches the repl: https://github.com/EmmanuelOga/deps-cider-cljs-reagent/blob/master/.dir-locals.el
it instructs cider to use the -A:cider
alias cmd, and in deps.edn there's a corresponding alias that enables figwheel. There's also config to automatically select a repl of figwheel-main
type and the dev
build.
sigh, that was a lot to write. Hopefully it will help someone, maybe not 🙂
You should put this on a blog (or just a Gist)! It's useful information.