Smarter wrapping logic for long parameter lists#281
Conversation
| .addStatement("return %T", Unit::class) | ||
| .build() | ||
| assertThat(source.toString()).isEqualTo(""" | ||
| |fun veryLongFunctionName( |
There was a problem hiding this comment.
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.
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