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

Strange indentation with nested lists in function calls #398

Closed
tonygentilcore opened this issue Aug 6, 2015 · 1 comment
Closed

Strange indentation with nested lists in function calls #398

tonygentilcore opened this issue Aug 6, 2015 · 1 comment

Comments

@tonygentilcore
Copy link

I'm running dartfmt from the 1.12.0-dev.3.1 Dart SDK on some Sky code.

Before:

    children.add(new DrawerHeader(children: [
        new Flex([avatar, username],
            justifyContent: FlexJustifyContent.center,
            direction: FlexDirection.vertical)]));

After:

    children.add(new DrawerHeader(
        children: [
      new Flex([avatar, username],
          justifyContent: FlexJustifyContent.center,
          direction: FlexDirection.vertical)
    ]));

The "before" formatting is just one example of several ways that'd be readable, but the "after" formatting is definitely not one of them. The Sky API encourages many levels of nested constructors so this comes up a lot. This is just a simple example, but I could provide many others if it is helpful.

/cc @ksimbili

@munificent
Copy link
Member

This is mostly working as intended. The style guide says that ] always goes on the next line when the list is multi-line. One thing we could possibly improve here is to allow children: to remain on the preceding line even though the argument contains a split. (In most cases, when an argument contains a newline internally, that forces the surrounding argument list to also split.)

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

No branches or pull requests

2 participants