facebook / ktfmt

A program that reformats Kotlin source code to comply with the common community standard for Kotlin code conventions.
https://facebook.github.io/ktfmt/
Apache License 2.0
898 stars 74 forks source link

Feature request: Automatic breaking of very long strings #219

Open bethcutler opened 3 years ago

bethcutler commented 3 years ago

When encountering strings that are over (or very near) the character limit, ktfmt makes no attempt to break the strings. Should it?

e.g. This code is not modified in any way, despite the fact that the last line exceeds 100 characters:

  val name
    get() =
      "A very very very long string that probably should be wrapped; should this be done automatically?"

one possible fix:

  val name
    get() =
      "A very very very long string that probably should be wrapped; should this be done " +
        "automatically?"
cgrushko commented 3 years ago

GJF does iirc, let's find out if we can reuse that code.