Skip to content

Returning functional types from when expression has extra indentation #222

@bethcutler

Description

@bethcutler

Actual ktfmt formatting:

fun getModifier(modifierType: ModifierType): (MyObject) -> MyModifiedObject {
  when (modifierType) {
    is FirstModifierType -> { myObject ->
        doCustomModificationForFirstModifierType(modifierType, myObject)
      }
    is SecondModifierType -> { myObject ->
        doCustomModificationForSecondModifierType(modifierType, myObject)
      }
  }
}

Expected ktfmt formatting:

fun getModifier(modifierType: ModifierType): (MyObject) -> MyModifiedObject {
  when (modifierType) {
    is FirstModifierType -> { myObject ->
      doCustomModificationForFirstModifierType(modifierType, myObject)
    }
    is SecondModifierType -> { myObject ->
      doCustomModificationForSecondModifierType(modifierType, myObject)
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions