I’m having problems with macro indentation in a CLJ/CLJS project. Details in thread.
An update on this issue with macro re-indentation changing after connecting a sibling CLJS REPL: • I’ve reproduced this using both shadow-cljs and Figwheel. • Checked with both CIDER 1.17 and 1.18. • I’ve created a small repo that exhibits the problem (using shadow-cljs) at https://github.com/simon-katz/cider-indentation-messing-up-with-cljs-sibling The README there gives instructions for reproducing. Should I create an issue at https://github.com/clojure-emacs/cider ?
Yes, please do! There've been a couple CLJS-related reports that I postponed to look into them at bulk. I don't do Clojurescript these days, so those issues tend to be overlooked, unfortunately.
FWIW, I’m now I’m unable to reproduce the problem with the simple shadow-cljs project I created yesterday. There’s still something weird with my Electric Clojure project, though. Grrrr! I’ll continue to investigate.
It looks like connecting a CLJS sibling REPL (without doing anything more) causes things in cider--get-symbol-indent to change, in particular the value of (nrepl-dict-get meta "style/indent") can change from a non-nil value to nil.
I’ll continue to look into this, but if anyone has an “Aha!” moment reading this, please let me know!
I guess it might be something odd in the Electric Clojure template app.
Initially I’m connected just to a CLJ REPL and everything works as I expect — macro calls indent according to CIDER’s generic rules and any :style/indent specifications.
If I then connect to a sibling CLJS REPL, when I reindent forms they get function-style indentation instead of macro indentation. It makes no difference whether the current REPL (as defined at https://docs.cider.mx/cider/usage/managing_connections.html#current-repl) is the CLJ one or the CLJS one.
If I then kill the CLJS REPL, things stay the same.
If I then kill the CLJ REPL, start a fresh one, and reload my code, everything works fine again.
Any ideas on what might be going on and how to fix it?
In case it might make any difference, I’m using shadow-cljs. (Actually I’m using Electric Clojure, which uses shadow-cljs.)
Actually, I see the same behaviour in a simple shadow-cljs project too (created following the shadow-cljs Quick Start instructions at https://github.com/thheller/shadow-cljs?tab=readme-ov-file#quick-start).