-
Notifications
You must be signed in to change notification settings - Fork 510
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
Reformat to over-lines code with max_line_length
limited
#1643
Comments
I can not reproduce the issue. For me the parameter wrapping is not activated. I have to reduce the max_line_length to 73 before the behavior is triggered. Please note that whenever you change the |
I've tried again on my other Mac, with the same result. Maybe I hadn't described this issue clearly, I meant ktlint formats class Bar {
val barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr by lazy { fooooooooooooo("fooooooooooooooooooooooooooooooooooooooooooooo", true) }
} to class Bar {
val barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr by lazy {
fooooooooooooo(
"fooooooooooooooooooooooooooooooooooooooooooooo",
true,
)
}
} but the class Bar {
val barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr by lazy {
fooooooooooooo("fooooooooooooooooooooooooooooooooooooooooooooo", true)
}
} is ok, can pass the lint. If I enlarge |
Ah, now I see what you mean. I consider this as an enhancement on the wrapping rule. If a line exceeds the max_line_length and it contains a BLOCK element type, it should break before start and after end of the block.
In addition to this, the wrapping run needs to run before the argument-list-wrapping / function-signature rule. |
…g that element exceeds the max line length or in case the block contains a newline Closes pinterest#1643
Expected Behavior
No need too many lines.
Observed Behavior
Original:
Reformay manually:
Steps to Reproduce
Reformatd by ktlint:
Your Environment
.editorconfig
settingsThe text was updated successfully, but these errors were encountered: