github facebook/ktfmt v0.31
0.31

latest releases: v0.56, v0.55, v0.54...
3 years ago

Formatting changes

  • Improve argument indentation when a multi-line function is followed by a lambda.

Before:

someFunction(
    first = arg1,
    second = arg2)
    .also { print(it) }

After:

someFunction(
        first = arg1,
        second = arg2)
    .also { print(it) }
  • Put function invocations on the same line when the variable name is shorter or equal to the indentation size
    • This is not new, but is now done more uniformly.

Before:

user
    .modify()
    .commit()

After:

user.modify()
    .commit()

Crash fixes

Library changes

Library usage before:

import com.facebook.ktfmt.format.format

val formattedCode = format(options, code)

Library usage after:

import com.facebook.ktfmt.format.Formatter

val formattedCode = Formatter.format(options, code)

Don't miss a new ktfmt release

NewReleases is sending notifications on new releases.