0.31
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
- Fix crash when using optional arrow in lambda
- Fix crash when optional semicolon is used in a long single-line lambda
- Support
expect enum class
without a body.
Library changes
- Update kotlin version to 1.6.10
- When formatting stdin, print formatted code to stdout regardless of whether it changed
- Refactored namespace and function organization - for example,
format
was previously a top-level function, but now it's a method on theFormatter
object.
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)