ruff/crates/ruff_python_formatter/src
Amethyst Reese 8fb29eafb8
[ruff] improve handling of intermixed comments inside from-imports (#20561)
Resolves a crash when attempting to format code like:

```
from x import (a as # whatever
b)
```

Reworks the way comments are associated with nodes when parsing modules,
so that all possible comment positions can be retained and reproduced during
formatting.

Overall follows Black's formatting style for multi-line import statements.

Fixes issue #19138
2025-10-07 08:14:09 -07:00
..
comments [ruff] improve handling of intermixed comments inside from-imports (#20561) 2025-10-07 08:14:09 -07:00
expression Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
module [ty] AST garbage collection (#18482) 2025-06-13 08:40:11 -04:00
other [ruff] improve handling of intermixed comments inside from-imports (#20561) 2025-10-07 08:14:09 -07:00
pattern Update pre-commit dependencies (#19162) 2025-07-07 04:07:44 +00:00
snapshots Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
statement [formatter] Fix missing blank lines before decorated classes in .pyi files (#18888) 2025-06-24 16:25:44 +02:00
string Update rust toolchain to 1.90 (#20469) 2025-09-18 16:54:49 +02:00
type_param [ty] AST garbage collection (#18482) 2025-06-13 08:40:11 -04:00
builders.rs Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
cli.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
context.rs Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
db.rs Update Rust toolchain to 1.88 and MSRV to 1.86 (#19011) 2025-06-28 20:24:00 +02:00
generated.rs Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
lib.rs Update Rust toolchain to 1.88 and MSRV to 1.86 (#19011) 2025-06-28 20:24:00 +02:00
main.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
options.rs Add support for using uv as an alternative formatter backend (#19665) 2025-09-09 20:39:53 +05:30
prelude.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
preview.rs [formatter] Fix missing blank lines before decorated classes in .pyi files (#18888) 2025-06-24 16:25:44 +02:00
range.rs [ty] AST garbage collection (#18482) 2025-06-13 08:40:11 -04:00
shared_traits.rs Upgrade Rust toolchain to 1.83 (#14677) 2024-11-29 12:05:05 +00:00
verbatim.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00