-
Notifications
You must be signed in to change notification settings - Fork 122
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
Inconsistent indentation of list literal between variable and getter declarations. #624
Comments
Same issue with map literals |
This is (more or less) intentional. It naturally falls out of how |
For this case, I often find myself changing to block-style function bodies in order to increase readability, which is unfortunate (I want that nice, clean, arrow syntax 😄) get y {
return [
...
];
} Or, I'm temped to use comments as a hack to force the opening bracket to match the indentation of the closing one. Myself and other members of my team think that starting the literal on the next line makes it easier to tell at a glance that the subsequent lines are within a list (when compared to the current formatting shown in the description). get y => //
[
...
]; Same for list-returning lambdas in argument lists with trailing-comma; I would prefer for the list to not have that continuation indent, similar to list arguments. Note the difference: new FooWidget(
y: () => [
...
],
z: [
...
],
); Any chance this issue could be revisited? Also is that argument list case a different enough code path that I should open a separate issue for it? |
I've also been running into this recently in multiple projects. One of them being Flutter where we have this pattern and are manually formatting to not use the extra indentation on @override
List<Source> get outputs => const <Source>[
Source.pattern('{OUTPUT_DIR}/vm_snapshot_data'),
Source.pattern('{OUTPUT_DIR}/isolate_snapshot_data'),
Source.pattern('{OUTPUT_DIR}/kernel_blob.bin'),
];
@override
List<String> get depfiles => <String>[
'flutter_assets.d',
];
I second this. |
This is doing what users want in the new tall style. \o/ Close #624.
Good news: The new tall style does what's being requested here. I have a PR out to add a regression test but the tall style formatter is already doing this so the bug is fixed. |
In the var declaration, the list is indented by two, in the getter, it's indented by six.
I'd prefer if they both used the var indentation.
The text was updated successfully, but these errors were encountered: