-
Notifications
You must be signed in to change notification settings - Fork 77
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
Google style with trailing comma does not use maxWidth correctly #472
Comments
The 1.0 issue mentioned merging trailing-comma management into all styles. If we do that, I think this issue is unblocked. We could switch the default behaviour of trailing-commas to do "nothing", rather than today where they trigger a line-break. Once that's done, management becomes:
Since the insertion happens before pretty-print, all the elements are already at their maximum length. We might get some lines that are unnecessarily wrapped after removal, but that's much less noticeable than exceeding max-width. |
As of v0.52 trailing comma management appears to be on for all styles. Is there any. The proposal above can be implemented. @hick209 |
This issue also happens with --kotlinglang-style now that this style enables trailing comma management. Any chance this can be fixed soon? It makes ktlint unhappy and complain about line width in AOSP :-) |
I implemented the idea in #472 (comment) and its not good. Imagine a case like I'd like to revive #473. It's got less surprising output and was also easier to implement. |
Hello!
There seems to be an off-by-one error when using Google-style and trailing commas. I just tried out the Google Style with trailing commas and saw the following scenario:
The line:
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
ends up being 101 characters even though I set maxWidth to 100.
If i change the named parameter to
uiSideEffects
, we see the following behavior, where it correctly wraps the line:My configuration is as follows:
The text was updated successfully, but these errors were encountered: