Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline lambda in function call or condition formated different than IntelliJ formatter #1200

Closed
miikeat opened this issue Aug 6, 2021 · 4 comments · Fixed by #1682
Closed

Comments

@miikeat
Copy link

miikeat commented Aug 6, 2021

Expected Behavior

IntelliJ with official Kotlin code style formats the following code like this:

val list = listOf<Boolean>()
fun test() {
    if (list.all {
            it == true
        }
    ) {
    }
}

Observed Behavior

ktlint complains about wrong indentation:

test.kt:4:1 Unexpected indentation (12) (should be 8) (indent)
test.kt:5:1 Unexpected indentation (8) (should be 4) (indent)

ktlintFormat changes the code to:

val list = listOf<Boolean>()
fun test() {
    if (list.all {
        it == true
    }
    ) {
    }
}

Your Environment

  • Version of ktlint used: 0.41.0
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): KtLint Gradle 10.0.0
  • Version of Gradle used (if applicable): 7.1.1
  • Operating System and version: OS: Garuda Linux - 5.10.55-1-lts
@shashachu
Copy link
Contributor

@miikeat would you be able to try with the latest snapshot and see if you're still getting this issue?

@paul-dingemans
Copy link
Collaborator

This problem still occurs with latest snapshot.

@paul-dingemans paul-dingemans added this to the 0.46.0 milestone Mar 17, 2022
@paul-dingemans paul-dingemans modified the milestones: 0.46.0, 0.47.0 Jun 1, 2022
@paul-dingemans paul-dingemans modified the milestones: 0.47.0, 0.48.0 Aug 14, 2022
@paul-dingemans
Copy link
Collaborator

Solved by #1682

@paul-dingemans
Copy link
Collaborator

Closed by #1682

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants