Skip to content

ktfmt removes blank lines between when clauses #342

Closed
@ghost

Description

Per https://kotlinlang.org/docs/coding-conventions.html#control-flow-statements, "In a when statement, if a branch is more than a single line, consider separating it from adjacent case blocks with a blank line"

Unfortunately, ktfmt removes such blank lines.

fun foo() {
    when {
        1 == 1 -> {
            println("The world is working okay")
        }
       
        1 > 2 -> {
            println("We may be in a parallel universe with different rules, do not proceed")
        }
    }
}

The blank line between the two cases gets removed, reproducible in https://facebookincubator.github.io/ktfmt/

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions