Skip to content

Fixing issue where ktlint would erroneously want to insert a newline if parameter comments were used #434

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

Merged
merged 5 commits into from
May 22, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ class IndentationRule : Rule("indent"), Rule.Modifier.RestrictToRootLast {
return
}
if (!node.nextCodeLeaf()?.prevLeaf {
// Skip comments, whitespace, and empty nodes
!it.isPartOfComment() &&
// Skip comments, whitespace, and empty nodes
!it.isPartOfComment() &&
!it.isWhiteSpaceWithoutNewline() &&
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This formatting looks weird to me, but IntelliJ does the same thing.

Copy link
Contributor

Choose a reason for hiding this comment

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

looks right; it's a continuation indent.

it.textLength > 0
}.isWhiteSpaceWithNewline() &&
}.isWhiteSpaceWithNewline() &&
// IDEA quirk:
// if (true &&
// true
Expand Down