cljfmt
cljfmt copied to clipboard
Discards lexical ,
It should be possible to use leading ,
to force indentation. cljfmt currently strips leading , leading to unexpected changes in indentation.
This is due to the treatment of ,
as simple whitespace by rewrite-clj, currently being addressed over there in xsc/rewrite-clj#44
[rewrite-clj "0.5.0"]
brings :comma
nodes which makes this more tractable. https://github.com/xsc/rewrite-clj/releases/tag/clojars-0.5.0
Looking at the linked examples, it looks like you want to keep commas when they're the first non-whitespace character on the line.
And anywhere else, removing them is fine?
So I use ,,
as a line prefix in require/import forms since none of the indenters happen to understand or format prefix lists meaningfully and that trick happens to work in CIDER. Same thing for cond
and other forms which have consecutive pairs that are not typically block indented when on different lines.
In general, I'm not sure that cljfmt should be removing commas when they occur.
Is this still an issue? I can't reproduce it, for me commas remain untouched. But I also couldn't reproduce it with older versions (tried 0.4.1, 0.5.0, which were current at the time), maybe I'm missing something.
@or one example I have that removes the comma is
(->> [] (map identity ,))
It's likely related to removing leading/trailing whitespace?