pinterest / ktlint

An anti-bikeshedding Kotlin linter with built-in formatter
https://pinterest.github.io/ktlint/
MIT License
6.23k stars 507 forks source link

Function-literal can format arguments into a commented out line #2850

Open adecker89 opened 2 weeks ago

adecker89 commented 2 weeks ago

Expected Behavior

Given a comment inside a lambda argument definition function-literal rule should not produce breaking changes.

Steps to Reproduce

Example:

foo {
    //comment
    x, y ->
    x
}

is formatted to:

foo {
    // comment x, y ->
    x
}

Your Environment

paul-dingemans commented 2 weeks ago

Tnx for reporting. This problem seems to exists starting from version 1.0.0. Did you find this problem while migrating from another ktlint version?