Skip to content
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

trailing commas should be automatically added where necessary to avoid incorrect indentation #1104

Closed
DetachHead opened this issue Mar 25, 2022 · 1 comment

Comments

@DetachHead
Copy link

from #1100:

code

void foo({String? value, int? value2}) {}

String bar(String value) => "";

void main() {
  return foo(
    value: bar(
      "",
    )
  );
}

actual result

void foo({String? value, int? value2}) {}

String bar(String value) => "";

void main() {
  return foo(
      value: bar(
    "",
  ));
}

expected result

it could instead add the missing trailing comma so that it gets formatted correctly:

void main() {
  return foo(
    value: bar(
      "",
    ),
  );
}

irl example

this also screws up the tree lines in the flutter intellij plugin:

class _State extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
        child: Row(
      children: const [Text("Foo")],
    ));
  }
}

image

@srawlins
Copy link
Member

Duplicate of #753?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants