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

Inconsistency with wrapping adjacent strings #1118

Closed
srawlins opened this issue Jun 14, 2022 · 2 comments
Closed

Inconsistency with wrapping adjacent strings #1118

srawlins opened this issue Jun 14, 2022 · 2 comments

Comments

@srawlins
Copy link
Member

I'm not sure where the bug is so I'm not sure how to title this issue. Take this input:

@Deprecated('loooooooooooooooooooooooong text string' 'loooooooooooooooooooooooong text string')
void f(
  @Deprecated('loooooooooooooooooooooooong text string' 'loooooooooooooooooooooooong text string')
      x,
) {
  'loooooooooooooooooooooooong text string' 'loooooooooooooooooooooooong text string';
}
/*34567 10   15   20   25   30   35   40   45   50   55   60   65   70   75   80*/

The formatter rewrites this as:

@Deprecated('loooooooooooooooooooooooong text string'
    'loooooooooooooooooooooooong text string')
void f(
  @Deprecated('loooooooooooooooooooooooong text string' 'loooooooooooooooooooooooong text string')
      x,
) {
  'loooooooooooooooooooooooong text string'
      'loooooooooooooooooooooooong text string';
}
/*34567 10   15   20   25   30   35   40   45   50   55   60   65   70   75   80*/

The 1st and 3rd pairs of adjacent strings are wrapped. But the middle one, a string in an annotation on a funtion parameter, is not wrapped. 🤔

The only open bug I could find which looks similar is #987

@munificent
Copy link
Member

Yeah, I think this is likely a different bug. I suspect that this has to do with a very obscure corner of the formatter that would be hard to describe. Thanks for reporting it. :)

@munificent
Copy link
Member

I honestly don't know what the old formatter was doing, but the simpler argument list splitting style in the forthcoming tall style yields:

@Deprecated(
  'loooooooooooooooooooooooong text string'
  'loooooooooooooooooooooooong text string',
)
void f(
  @Deprecated(
    'loooooooooooooooooooooooong text string'
    'loooooooooooooooooooooooong text string',
  )
  x,
) {
  'loooooooooooooooooooooooong text string'
      'loooooooooooooooooooooooong text string';
}

Looks pretty clear 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

2 participants