ruff/crates/ruff_python_formatter/src
Micha Reiser 5a876ed25e
Visit `Identifier` node as part of the `SourceOrderVisitor` (#17110)
## Summary

I don't remember exactly when we made `Identifier` a node but it is now
considered a node (it implements `AnyNodeRef`, it has a range). However,
we never updated
the `SourceOrderVisitor` to visit identifiers because we never had a use
case for it and visiting new nodes can change how the formatter
associates comments (breaking change!).
This PR updates the `SourceOrderVisitor` to visit identifiers and
changes the formatter comment visitor to skip identifiers (updating the
visitor might be desired because it could help simplifying some comment
placement logic but this is out of scope for this PR).

## Test Plan

Tests, updated snapshot tests
2025-04-01 16:58:09 +02:00
..
comments Visit `Identifier` node as part of the `SourceOrderVisitor` (#17110) 2025-04-01 16:58:09 +02:00
expression bump MSRV to 1.83 (#16294) 2025-02-26 06:12:43 -08:00
module Upgrade to Rust 1.78 (#11260) 2024-05-03 12:46:21 +00:00
other [formatter] Stabilize fix for single-with-item formatting with trailing comment (#16603) 2025-03-13 15:37:37 +01:00
pattern Remove `AstNode` and `AnyNode` (#15479) 2025-01-17 17:11:00 -05:00
snapshots Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
statement Rename `ExprStringLiteral::as_unconcatenated_string()` to `ExprStringLiteral::as_single_part_string()` (#16253) 2025-02-19 16:06:57 +00:00
string Pass `ParserOptions` to the parser (#16220) 2025-02-19 10:50:50 -05:00
type_param Remove `AstNode` and `AnyNode` (#15479) 2025-01-17 17:11:00 -05:00
builders.rs Fix unstable f-string formatting for expressions containing a trailing comma (#15545) 2025-01-17 10:08:09 +01:00
cli.rs Pass `ParserOptions` to the parser (#16220) 2025-02-19 10:50:50 -05:00
context.rs Fix unstable f-string formatting for expressions containing a trailing comma (#15545) 2025-01-17 10:08:09 +01:00
generated.rs Auto-generate AST boilerplate (#15544) 2025-01-17 14:23:02 -05:00
lib.rs Pass `ParserOptions` to the parser (#16220) 2025-02-19 10:50:50 -05:00
main.rs Formatter and parser refactoring (#7569) 2023-09-26 15:29:43 +02:00
options.rs Use `ast::PythonVersion` internally in the formatter and linter (#16170) 2025-02-18 12:03:13 -05:00
prelude.rs Accept any `Into<AnyNodeRef>` as `Comments` arguments (#5205) 2023-06-20 16:49:21 +00:00
preview.rs [formatter] Stabilize fix for single-with-item formatting with trailing comment (#16603) 2025-03-13 15:37:37 +01:00
range.rs Rename `visit_preorder` to `visit_source_order` (#17046) 2025-03-28 19:40:26 +00:00
shared_traits.rs Upgrade Rust toolchain to 1.83 (#14677) 2024-11-29 12:05:05 +00:00
verbatim.rs Upgrade Rust toolchain to 1.83 (#14677) 2024-11-29 12:05:05 +00:00