Skip to content

0.19

Compare
Choose a tag to compare
@cgrushko cgrushko released this 23 Dec 17:06

Significant changes:

Now using Kotlin 1.4

In particular, fun interface is now supported.

Do not break due to annotations parameters

@Dimenstion(unit = DP) @Px fun g(): Int = 5

instead of

@Dimenstion(unit = DP)
@Px
fun g(): Int = 5

Break after each class/fun param, if they don't all fit in one line

fun foo12(
    a: Int,
    var b: Double,
    val c: String
) {
    //
}

instead of

fun foo12(
    a: Int, var b: Double, val c: String
) {
    //
}

Don't break before lambda when initializing property

val lambda = {
  ...
}

instead of

val lambda =
    {
      ...
    }

Constructor is now indented on level of class

class Foo
constructor(
    a: Int,
    b: Int
)

instead of

class Foo
    constructor(
        a: Int,
        b: Int
    )

Other changes

  • Fix: Handle ; between property and accessor (e.g., var x = false; private set)
  • Fix: Don't break after variable declaration in when expression (e.g., when (val y = x.improved()) { … } )
  • Fix: Allow line breaks after as and is
  • FIx: Fix comment indent inside of lambdas
  • Fix: Make secondary constructors more like function declarations
  • Fix: Don't crash on trailing commas in lambdas parameters

Get it on Maven Central: https://search.maven.org/artifact/com.facebook/ktfmt/0.19/jar