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

Nested cascades don't nest indentation #999

Closed
munificent opened this issue Feb 25, 2021 · 4 comments
Closed

Nested cascades don't nest indentation #999

munificent opened this issue Feb 25, 2021 · 4 comments

Comments

@munificent
Copy link
Member

The formatter currently produces:

void main() {
  final object = outer(inner()
    ..innerProperty1 = 1
    ..innerProperty2 = 2)
    ..outerProperty = 3;
}

Note that innerProperty and outerProperty are at the same indentation depth even though there are cascades on different objects. I'd expect something like:

void main() {
  final object = outer(inner()
      ..innerProperty1 = 1
      ..innerProperty2 = 2)
    ..outerProperty = 3;
}
@natebosch
Copy link
Member

Is this related at all to #760

@munificent
Copy link
Member Author

Probably.

@srawlins
Copy link
Member

Drive by: WIP tall style formatter outputs this, which I think is working as intended:

void main() {
  final object = outer(
    inner()
      ..innerProperty1 = 1
      ..innerProperty2 = 2,
  )..outerProperty = 3;
}

@munificent
Copy link
Member Author

The forthcoming tall style handles argument lists and cascades differently. With the new style, you get:

void main() {
  final object = outer(
    inner()
      ..innerProperty1 = 1
      ..innerProperty2 = 2,
  )..outerProperty = 3;
}

That fixes the ambiguous nesting problem and looks pretty good to me.

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

3 participants