Closed tzzh closed 4 years ago
cljfmt doesn't distinguish indentation forms on the basis of whether the name is a function or a macro, but rather on the function semantics. assoc
is indeed hard-coded in cljfmt to use the cond1
indentation, which means that:
OTOH, cljfmt doesn't actually know about assoc-in
at all, so it gets the default list
indentation style, the same as some function you write yourself.
Possibly cljfmt should recognize assoc-in
and use cond1
for it, though it's a little different from other cond1
-style functions/macros in that it takes exactly 3 args, not a variable number.
In any case, you can override the indentation if you like in your .cljfmt. For example, this swaps the two functions' indentation styles:
{:indent-overrides ["assoc" :list
"assoc-in" :cond1]}
(assoc a
:a
b)
(assoc-in a
[:a :b]
c)
@cespare OK cheers thanks for the explanation 👍
I love the formatter and use it everywhere, but there is one thing that bothers me and I am not sure it's an issue as it seems to be on purpose but I don't really understand the
assoc
formattingI kind of understand this formatting for some macros e.g
cond
but I find it a bit weird for functions especially given here it's not consistent withassoc-in
which would be