ruff/crates/ruff_python_formatter/src/comments
Charlie Marsh 87984e9ac7
Expand parents whenever open-parenthesis comments are present (#6389)
## Summary

This PR modifies our dangling-open-parenthesis handling to _always_
expand the parent expression.

So, for example, given:

```python
a = int(  # type: ignore
    int(  # type: ignore
        int(  # type: ignore
            6
        )
    )
)
```

We now retain that as stable formatting, instead of truncating like:

```python
a = int(int(int(6)))  # comment  # comment  # comment
```

Note that Black _does_ collapse comments like this _unless_ they're `#
type: ignore` comments, and perhaps in some other cases, so this is an
intentional deviation
([playground](https://black.vercel.app/?version=main&state=_Td6WFoAAATm1rRGAgAhARYAAAB0L-Wj4AFEAHpdAD2IimZxl1N_WlOfrjryFgvD4ScVsKPztqdHDGJUg5knO0JCdpUfW1IrWSNmIJPx95s0hP-pRNkCQNH64-eIznIvXjeWBQ5-qax0oNw4yMOuhwr2azvMRZaEB5r8IXVPHmRCJp7fe7y4290u1zzxqK_nAi6q_5sI-jsAAAAA8HgZ9V7hG3QAAZYBxQIAAGnCHXexxGf7AgAAAAAEWVo=)).
2023-08-08 08:45:20 -04:00
..
snapshots Rename Arguments to Parameters in the AST (#6253) 2023-08-01 13:53:28 -04:00
debug.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
format.rs Expand parents whenever open-parenthesis comments are present (#6389) 2023-08-08 08:45:20 -04:00
map.rs Correctly associate own-line comments in bodies (#4671) 2023-06-01 08:12:53 +02:00
mod.rs Avoid hard line break after dangling open-parenthesis comments (#6380) 2023-08-07 14:15:32 +00:00
node_key.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
placement.rs Rename ArgumentSeparator to ParameterSeparator (#6404) 2023-08-07 15:46:28 -04:00
visitor.rs Rename CommentPlacement#then_with to or_else (#6341) 2023-08-04 13:50:57 +00:00