-
Notifications
You must be signed in to change notification settings - Fork 506
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
Ktlint reporting unexpected indentation when formatting lambdas with trailing comma #1247
Comments
Even worse, due to the #967, there appears to be no workaround for this (other than disabling indent rule globally). |
This also seems to not be playing well with #1032 at all. |
This is really an interesting code sample. The trailing comma after variable When code style preference
But in both cases the IntelliJ formatting looks better than the current formatting of Ktlint shown below:
I think we should use the same formatting style in both cases. I prefer the style which is used when no trailing comma is found, so:
@romtsn @Tapchicoma What do you think? |
I prepared a fix but have to come back on my preference above. This looks prettier in this example due to the extremely short variable name
|
Can we even decide on the format, though? I assume whatever IntelliJ's formatter spits out, it must also be valid ktlint formatting? Since, from what I can see, there is no way to tell IntelliJ's formatter to format it like that. |
For me the only requirements are:
Code formatted by fix #1293 applies to those rules. |
Closes #1247 Co-authored-by: Paul Dingemans <pdingemans@bol.com> Co-authored-by: Sha Sha Chu <shasha@pinterest.com>
Following code:
has been formatted with default IntelliJ kotlin code style + trailing comma enabled
Expected Behavior
ktlint should accept the code
Observed Behavior
ktlint fails with
Your Environment
The text was updated successfully, but these errors were encountered: