ktfmt icon indicating copy to clipboard operation
ktfmt copied to clipboard

Short implementations of functional interfaces could be on a single line

Open bethcutler opened this issue 4 years ago • 2 comments

Actual:

fun interface VeryVeryLongCustomInterface {
  fun function(options: Options): EndResult
}

val EMPTY_VERY_VERY_LONG_CUSTOM_INTERFACE: VeryVeryLongCustomInterface =
    VeryVeryLongCustomInterface {
  EndResult
}

Preferable, perhaps?

val EMPTY_VERY_VERY_LONG_CUSTOM_INTERFACE: VeryVeryLongCustomInterface =
    VeryVeryLongCustomInterface { EndResult }

bethcutler avatar Oct 13 '21 20:10 bethcutler

I think this is the same as https://github.com/facebookincubator/ktfmt/issues/252. cc @strulovich

cgrushko avatar Oct 14 '21 08:10 cgrushko

BTW this happens because of the line break. If there were no line breaks it would be placed on a single line

val EMPTY: VeryVeryLongCustomInterface = VeryVeryLongCustomInterface { EndResult }

hick209 avatar Jun 05 '24 19:06 hick209