-
Notifications
You must be signed in to change notification settings - Fork 75
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
Long expression inside parentheses causes only trailing )
to be on new line
#319
Comments
I suspect this is happening because the condition expressions are in their own level, within the paren-level. The layout engine determines that condition-level can fit on one line, but is then forced to take the next break, before the closing paren. One easy solution would be to unify the breaks after the opening paren and before the closing paren. |
)
to be on new line
This looks like an issue with Google style only. @nreid260, do you want to deal with that? Looks like this is the place to add another break: You might want to check it against your code to see it doesn't create anything funny looking. |
I don't think this is
That said, it may help to make the unified break guarded by |
We use the "Java-like" option on that page, which makes it break as:
|
Ahh ok yeah I can see it now. Without the unified break introduced by I think we'd support either adding a break inside the opening paren, or removing the one before the closing paren. I'll have to confirm. |
I see this for Kotlin, as well as Google, style. |
@att14, what do you mean by "Kotlin style"? |
kotlinlang, I think I have seen it too. |
If the fix is only for Google one, this should be reopened because it is happening in Kotlinlang too |
@JavierSegoviaCordoba this appears to be fixed for me with Kotlinlang style. |
yep, it is working for me too |
If a conditional line is just over the max-line length, the
) {
will appear on the next line.Will be reformatted as:
If you add some more to the expression, the line gets broken up.
It seems like in the first example, it should consider the entire line too long and break up the expression, regardless of if moving the parenthesis to the next line will be short enough.
Maybe this is the expected behavior, but I looked for other issues and couldn't find anything related, so I thought I'd bring it up.
Personally, I'd always put the expression on a separate line when splitting.
But, I know this isn't about my personal style, and I still feel like only the
) {
on the next line is a little strange.The text was updated successfully, but these errors were encountered: