Closed imrekoszo closed 1 month ago
I would expect that lists starting with keywords (function application in most cases) are treated as symbols for the purpose of indentation.
I would expect that lists starting with keywords (function application in most cases) are treated as symbols for the purpose of indentation.
I don't have a very strong opinion about this, it's just that my understanding of @tonsky's rule 1 is that it's only about symbols.
I can see this either way. I think I prefer the 2 space indentation as it creates a stronger indentation impression, especially with reader conditionals.
The good news is: as the ns
form is always "printed from scratch" it will always be consistent regardless of the initial input format.
@oakmac are you looking to apply that 2 space indentation to other lists-starting-with-a-keyword as well, i.e. treating keywords as symbols for this purpose as Noah suggests, or are you looking to only do 2 spaces for the ones in the ns form? My personal preference would be consistency between the two.
My 2 cents:
((abc)
def)
we had to make exception (1 space) for when first place is list/vector/map.
So now we have a situation:
But the rest is up to intepretation.
One can make a case that then reader macro will look off:
#?(:clj ...
:cljs ...)
Also lists when they are just lists:
'(1
2
3)
So it looks like any list with non-symbol in first place should be 1-space indented?
Some thoughts on this:
ns
forms being "printed from scratch" and always consistent.ns
form has it's own rules for indentation.
My personal preference is two-space indentation (how it works now), but I am leaning toward one-space indentation in order to match how to ns. This project has taken a lot of guidance from those recommendations, so I think it makes sense to follow it here.
It also seems like one-space indentation is far more common than two space:
is currently (
@chrisoakman/standard-clojure-style@0.3.0
) formatted toas opposed to
Rule 2:
Edit: applies to other clauses as well: