-
Notifications
You must be signed in to change notification settings - Fork 288
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
Smarter wrapping logic for long parameter lists #281
base: main
Are you sure you want to change the base?
Conversation
.addStatement("return %T", Unit::class) | ||
.build() | ||
assertThat(source.toString()).isEqualTo(""" | ||
|fun veryLongFunctionName( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what the style guide says about that, but having nested wrapping felt like an overkill. Hence, lambda types as function parameters are always single-line, even if they wrap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This behavior should also be consistent with the discussion on #256: we don't wrap the lambda parameters, but we do wrap the function parameters.
d097fc8
to
e91ebae
Compare
I think I'll update this PR to cover #291 as well. Any feedback here so far? |
I certainly like the results. When do you emit a parameter spec with wrapping=False? |
When you've got a parameterized fun veryLongFunctionName(
veryLongParameterName: (java.io.Serializable, java.lang.Appendable, kotlin.Cloneable) -> kotlin.Unit,
i: kotlin.Int
) = kotlin.Unit |
Ah, nice. I think I'd prefer if we flipped the boolean so that it wraps by default and we opt-out only in the lambda special case. |
Can do |
e91ebae
to
a5e5eb0
Compare
a5e5eb0
to
09a1c92
Compare
Fixes #291 |
Any updates on this request? |
@gilgoldzweig we'll most likely go with a solution for #532, which should handle this use-case as well. |
Cool, is there any way to make it work now? |
There's no workaround unfortunately, but if your function/constructor has more than 2 parameters we'll auto-wrap it. |
Fixes #274