mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-25 21:37:26 +00:00
Respect own-line leading comments before parenthesized nodes (#6820)
## Summary
This PR ensures that if an expression has an own-line leading comment
_before_ its open parentheses, we render it as such.
For example, given:
```python
[ # foo
# bar
( # baz
1
)
]
```
On `main`, we format as:
```python
[ # foo
(
# bar
# baz
1
)
]
```
As of this PR, we format as:
```python
[ # foo
# bar
( # baz
1
)
]
```
## Test Plan
`cargo test`
This commit is contained in:
parent
59e70896c0
commit
813d7da7ec
4 changed files with 44 additions and 16 deletions
|
|
@ -50,3 +50,11 @@ c1 = [ # trailing open bracket
|
|||
second,
|
||||
third
|
||||
] # outer comment
|
||||
|
||||
[ # inner comment
|
||||
# own-line comment
|
||||
( # end-of-line comment
|
||||
# own-line comment
|
||||
first,
|
||||
),
|
||||
] # outer comment
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue