I'm looking at updating a project from ktlint 1.10...
# ktlint
j
I'm looking at updating a project from ktlint 1.10.2 to 1.13.1, and I see that it wants to change an indentation:
Copy code
val snapshot: Snapshot
         get() {
             val bucketCounts = Array(thresholdCounts.size) {
-                i ->
+                    i ->
                 Pair(Pair(thresholds[i], thresholds[i + 1]), thresholdCounts[i].sum())
             }
Why is it better to have the variable indented like that? It seems odd to me.
Or is it better to have the variable on the previous line after the curly, and if so, why doesn't ktlint enforce/do that?
j
Ktlint attempts to follow the default Kotlin formatting that IJ outputs. I don't know if this group actually has an opinion TBH
j
Aha...is there a separate channel for where the IntelliJ style is discussed/decided?
j
¯\_(ツ)_/¯
I actually don't know, @tapchicoma ^^
j
(I can indeed confirm that this what IntelliJ does.)
t
Don't know as well. Best way would be open a new issue in ktlint project
b
@Jonathan Lennox i think i’ve seen this before too, and i believe this is referred to as a “continuation indent”, and it’s usually done as one indent past what the code indentation would be at that level (in some places i think it looks ok, like overflowing function arguments, but here it’s pretty annoying)
but there might be a continuation indent default you could set/override in editorconfig
e
having
{ i ->
on the same line is definitely the more common style