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

Tall style: Regression for block-style LHS #1535

Open
nex3 opened this issue Aug 16, 2024 · 2 comments
Open

Tall style: Regression for block-style LHS #1535

nex3 opened this issue Aug 16, 2024 · 2 comments

Comments

@nex3
Copy link
Member

nex3 commented Aug 16, 2024

The tall style formats the following code as so:

void main() {
  for (var i = 0; i < _importers.length; i++) {
    for (var j = 0; j < i; j++) {
      _perImporterCanonicalizeCache[(
            _importers[j],
            url,
            forImport: forImport,
          )] =
          null;
    }
  }
}

where previously it was formatted as

void main() {
  for (var i = 0; i < _importers.length; i++) {
    for (var j = 0; j < i; j++) {
      _perImporterCanonicalizeCache[(
        _importers[j],
        url,
        forImport: forImport,
      )] = null;
    }
  }
}

The former seems worse to me, and the latter doesn't seem obviously contrary to the tall style.

@munificent
Copy link
Member

Oh, wow, interesting. Yeah, the new style doesn't recognize an index operator expression as a being block-formattable, which is why you get the extra indentation. I had never even considered that you might have a large enough index operand to cause it to split on the LHS.

For what it's worth, if this were my code, I'd probably hoist the record literal out to a local variable because I find this fairly hard to read in either formatting style. But I agree the tall style output isn't ideal.

@nex3
Copy link
Member Author

nex3 commented Aug 19, 2024

I've always been a bit more LISP-brained than you 🙂

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