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
933 stars 78 forks source link

Android Studio plugin adds trailing commas #519

Closed alvindizon closed 1 month ago

alvindizon commented 1 month ago

Just tried https://plugins.jetbrains.com/plugin/14912-ktfmt and found that it adds trailing commas, is this the intended behavior? Running the Gradle task spotlessCheck doesn't add commas.

hick209 commented 1 month ago

Yes, this is intentional for styles that use that

See here https://github.com/facebook/ktfmt/blob/main/core/src/main/java/com/facebook/ktfmt/format/FormattingOptions.kt#L47-L54

And here https://github.com/facebook/ktfmt/blob/main/core/src/main/java/com/facebook/ktfmt/format/Formatter.kt#L45-L66