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

Line longer than 80 characters in class type parameters #1568

Open
stereotype441 opened this issue Sep 28, 2024 · 1 comment · May be fixed by #1576
Open

Line longer than 80 characters in class type parameters #1568

stereotype441 opened this issue Sep 28, 2024 · 1 comment · May be fixed by #1576

Comments

@stereotype441
Copy link
Member

https://dart-review.googlesource.com/c/sdk/+/386736 introduces several declarations that look similar to this:

abstract interface class TypeAnalyzerOperations<
        TypeStructure extends SharedTypeStructure<TypeStructure>,
        Variable extends Object,
        TypeParameterStructure extends SharedTypeParameterStructure<TypeStructure>,
        TypeDeclarationType extends Object,
        TypeDeclaration extends Object>
    implements FlowAnalysisOperations<Variable, SharedTypeView<TypeStructure>> {
  ...
}

Note that the line TypeParameterStructure extends SharedTypeParameterStructure<TypeStructure>, is longer than 80 characters. The formatter insists on placing this text all on the same line, causing failures in the lines_longer_than_80_chars lint.

To see more examples, search for the text // ignore: lines_longer_than_80_chars in https://dart-review.googlesource.com/c/sdk/+/386736.

@srawlins
Copy link
Member

That's the kind of bug that I'd be tempted to just turn a blind eye to. 😅

Half joking. This bug is the kind of thing that indicates, maybe the code isn't readable longer than 80 chars, and maybe it isn't readable wrapped into multiple lines; maybe there is a naming solution, or a typedef solution, that results in more readable code.

munificent added a commit that referenced this issue Oct 8, 2024
The tall style was already doing a better job on #1568 than the old
short style does. (I don't know why it leaves an overly long line there.
It seems like a bug but perhaps a nasty subtle one in the solver.)

But it still didn't allow splitting before `extends` in a bound which
could leave long lines in cases where the type parameter and bound name
are both quite long. Rare, but we may as well do a better job.

So this introduces a new piece that allows splitting before `extends`
if needed.

Fix #1568.
@munificent munificent linked a pull request Oct 8, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants