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

Formatter moves inline comment in external declaration #1585

Closed
munificent opened this issue Oct 23, 2024 · 0 comments · Fixed by #1588
Closed

Formatter moves inline comment in external declaration #1585

munificent opened this issue Oct 23, 2024 · 0 comments · Fixed by #1588
Labels

Comments

@munificent
Copy link
Member

Given this (sanitized) input:

class AaaaAaaaa {
  external Aaaaaa get aa;
  external Aaaaaa get aaAaa;
  external Aaaaaa get aa;
  external aaaa get aaaa;
  external /*AaaaaaAaaa*/ aaa get aa;
  external Aaaaaa get aaa;
}

The formatter outputs:

class AaaaAaaaa {
  external Aaaaaa get aa;
  external Aaaaaa get aaAaa;
  external Aaaaaa get aa;
  external aaaa get aaaa; /*AaaaaaAaaa*/
  external aaa get aa;
  external Aaaaaa get aaa;
}
@munificent munificent added the bug label Oct 23, 2024
munificent added a commit that referenced this issue Oct 24, 2024
When formatting a function, method, getter, or function type, the
formatter hoists any leading comments out so that they don't force a
split between the return type and body.

However, it failed to take into account modifiers that may occur before
the return type but after the comment. If that happened, the comment
would get moved before the modifiers.

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

Successfully merging a pull request may close this issue.

1 participant