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

Indentation regression with inline lambda in function call #1202

Closed
Gama11 opened this issue Aug 6, 2021 · 2 comments · Fixed by #1203
Closed

Indentation regression with inline lambda in function call #1202

Gama11 opened this issue Aug 6, 2021 · 2 comments · Fixed by #1203

Comments

@Gama11
Copy link

Gama11 commented Aug 6, 2021

Note: this is a regression compared to 0.41.0 that is still present in the 0.42.1 patch release where some indentation bugs were already fixed.

ktlint -F turns the following:

class Foo {
    fun bar() {
        val foo = bar.associateBy({ item -> item.toString() }, ::someFunction).toMap()
    }
}

into

class Foo {
    fun bar() {
        val foo = bar.associateBy({ item -> item.toString() }, ::someFunction).toMap()
        }
    }
@shashachu
Copy link
Contributor

@Gama11 thanks for the report. we have a few rules than can touch indentation (likely part of the problem). Can you run ktlint --verbose to verify which of the rules is reformatting it?

@Gama11
Copy link
Author

Gama11 commented Aug 6, 2021

Sure - I assume indent is the name of the rule:

Unexpected indentation (4) (should be 8) (indent)
Unexpected indentation (0) (should be 4) (indent)
Unexpected indentation (0) (should be 4) (indent)

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

Successfully merging a pull request may close this issue.

2 participants