-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: Trailing comment on list gets formatted to a separate line #6367
Comments
I can take a look. |
This might be relevant: I noticed it first while working on the ruff/crates/ruff_python_formatter/tests/snapshots/format@statement__match.py.snap Lines 32 to 36 in a755afe
which gets formatted correctly (although the comments are in wrong order) when using ruff/crates/ruff_python_formatter/tests/snapshots/format@statement__match.py.snap Line 93 in a755afe
But, it gets formatted in the way mentioned in the issue description when using
|
It kind of feels like a bug in line_suffix, but I need to understand the implementation better to say for certain. |
## Summary Given: ```python [ # comment first, second, third ] # another comment ``` We were adding a hard line break as part of the formatting of `# comment`, which led to the following formatting: ```python [first, second, third] # comment # another comment ``` Closes #6367.
…l-sh#6380) ## Summary Given: ```python [ # comment first, second, third ] # another comment ``` We were adding a hard line break as part of the formatting of `# comment`, which led to the following formatting: ```python [first, second, third] # comment # another comment ``` Closes astral-sh#6367.
Given:
Notice that there's no magic trailing comma, so the list will be collapsed.
Ruff:
Black:
The text was updated successfully, but these errors were encountered: