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

Fixing bug with extra indentation after lambda arrow #508

Merged
merged 2 commits into from
Jul 5, 2019

Conversation

shashachu
Copy link
Contributor

Fixes #479

Copy link
Collaborator

@Tapchicoma Tapchicoma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Generally, for lambdas, according to kotlin styleguide, this rule should format either to:

foo.func { param1, param2 ->
    doSomething()
    doSomething2()
}

or, if lambda params can't fit in max line:

foo.func { 
    param1, 
    param2
    ->
    doSomething()
    doSomething2()
}

@shashachu
Copy link
Contributor Author

LGTM 👍

Generally, for lambdas, according to kotlin styleguide, this rule should format either to:

foo.func { param1, param2 ->
    doSomething()
    doSomething2()
}

or, if lambda params can't fit in max line:

foo.func { 
    param1, 
    param2
    ->
    doSomething()
    doSomething2()
}

Thanks; I did notice that as well. I'll open up another issue about moving params to the same line as the open bracket. It might be difficult to have it not conflict with the max_line_length rule. It looks like IntelliJ only moves the params if they're on the same line as the arrow, so we can follow that rule as well.

@shashachu shashachu merged commit f4e5358 into pinterest:master Jul 5, 2019
@shashachu shashachu deleted the arrow-indent branch July 5, 2019 16:23
sowmyav24 pushed a commit to sowmyav24/ktlint that referenced this pull request Jul 18, 2019
* Fixing bug with extra indentation after lambda arrow

Fixes pinterest#479

* Adding tests
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 this pull request may close these issues.

Indentation on lambda's closing brace
2 participants