ruff/crates/ruff_python_formatter/src
Charlie Marsh cc9e84c144
Format trailing operator comments as dangling (#7427)
## Summary

Given a trailing operator comment in a unary expression, like:

```python
if (
  not  # comment
  a):
    ...
```

We were attaching these to the operand (`a`), but formatting them in the
unary operator via special handling. Parents shouldn't format the
comments of their children, so this instead attaches them as dangling
comments on the unary expression. (No intended change in formatting.)
2023-09-15 20:34:09 -04:00
..
comments Format trailing operator comments as dangling (#7427) 2023-09-15 20:34:09 -04:00
expression Format trailing operator comments as dangling (#7427) 2023-09-15 20:34:09 -04:00
module Format empty lines in stub files like black's preview style (#7206) 2023-09-11 08:03:59 +00:00
other Don't reorder parameters in function calls (#7268) 2023-09-13 09:01:49 +00:00
pattern Introduce Token element (#7048) 2023-09-02 10:05:47 +02:00
snapshots Remove exception-handler lexing from `unused-bound-exception` fix (#5851) 2023-07-18 18:27:46 +00:00
statement Don't reorder parameters in function calls (#7268) 2023-09-13 09:01:49 +00:00
type_param Introduce Token element (#7048) 2023-09-02 10:05:47 +02:00
builders.rs Introduce Token element (#7048) 2023-09-02 10:05:47 +02:00
cli.rs Show header for formatter comment decoration info (#7228) 2023-09-08 09:25:06 +00:00
context.rs Implement DerefMut for WithNodeLevel (#6443) 2023-08-11 10:41:48 +00:00
generated.rs Introduce AST nodes for `PatternMatchClass` arguments (#6881) 2023-08-26 14:45:44 +00:00
lib.rs Catch panics in formatter (#7377) 2023-09-14 11:44:16 -04:00
main.rs Formatter: Add SourceType to context to enable special formatting for stub files (#6331) 2023-08-04 11:52:26 +00:00
options.rs Introduce `IndentWidth` (#7301) 2023-09-13 14:52:24 +02:00
prelude.rs Accept any `Into<AnyNodeRef>` as `Comments` arguments (#5205) 2023-06-20 16:49:21 +00:00
verbatim.rs Memoize text width (#6552) 2023-09-06 07:10:13 +00:00