Hello! We're looking at enabling managed trailing commas, but there's some interesting behavior w/enums which have member declarations. Given an enum like:
enum class ProtocolState {
WAITING {
override fun signal() = TALKING
},
TALKING {
override fun signal() = WAITING
},
;
abstract fun signal(): ProtocolState
}
ktfmt with manageTrailingCommas = false will ignore the trailing comma / semi-placement, which allows for adding new entries where the diff is purely the added lines. This is also the case for ktlint (and in fact, if you omit the trailing comma before the semi, it will insert it). However, ktfmt with manageTrailingCommas = true will remove the trailing comma in favor of just the terminating semicolon, which results in diff churn when adding new entries.
Is there a rule / reasoning for this behavior, or could this be considered for change? If so I don't mind contributing the patch.
Hello! We're looking at enabling managed trailing commas, but there's some interesting behavior w/enums which have member declarations. Given an enum like:
ktfmtwithmanageTrailingCommas = falsewill ignore the trailing comma / semi-placement, which allows for adding new entries where the diff is purely the added lines. This is also the case forktlint(and in fact, if you omit the trailing comma before the semi, it will insert it). However,ktfmtwithmanageTrailingCommas = truewill remove the trailing comma in favor of just the terminating semicolon, which results in diff churn when adding new entries.Is there a rule / reasoning for this behavior, or could this be considered for change? If so I don't mind contributing the patch.