-
Notifications
You must be signed in to change notification settings - Fork 120
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
no extra-indent of expression function as argument with trailing comma #794
Conversation
I think this is by design. @munificent will have thoughts |
As this looks similar to #382 (that is not closed) this change seems doable. (Context: I try to apply |
71156cd
to
f6bdf13
Compare
The same behaviour could be done on function declarations and method declarations (I did it in a14n@7a51442 - happy to include it in this PR). |
I'm a little swamped with other stuff to take a look at these right now, but I'll try to circle back when I can. I have some vague concerns that this will do bad things on more complex cases, so I'll need to run it on a bigger corpus and see what the results look like. The output you have here looks nice to me. It's mostly a question of making sure it doesn't regress other things. |
The only concern I have is when the function split after onTap: () {
Navigator.of(context).push(CupertinoPageRoute<void>(
title: colorName,
builder_______________________________________________: (BuildContext context) =>
Tab1ItemPage(
color: color,
colorName: colorName,
index: index,
),
));
}, Ideally in this case I'd like to have: onTap: () {
Navigator.of(context).push(CupertinoPageRoute<void>(
title: colorName,
builder_______________________________________________: (BuildContext context) =>
Tab1ItemPage(
color: color,
colorName: colorName,
index: index,
),
));
}, But I don't manage to write the good code to handle this case and to produce what I'd like :-( |
I think best would be this: onTap: () {
Navigator.of(context).push(CupertinoPageRoute<void>(
title: colorName,
builder_______________________________________________: (BuildContext context) =>
Tab1ItemPage(
color: color,
colorName: colorName,
index: index,
),
));
}, |
@munificent friendly reminder |
I tested this out on a big corpus locally. Overall, I like the output. However, like you note, the results are pretty weird when it needs to indent before the body of the function, as in: function(
(parameter1, parameter2,
parameter3) =>
P(
p,
),
); Cases like this seem pretty rare in the wild though, so I think it's still worth doing. |
Actual:
Expected: