Format call expressions (without call chaining)#5341
Conversation
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinuxWindows |
37fdcdd to
8bc2b89
Compare
c15c45a to
ebf1c09
Compare
Cargo.toml
Outdated
| #ruff_text_size = { path = "../disk/projects/RustPython-Parser/ruff_text_size" } | ||
| #rustpython-ast = { path = "../disk/projects/RustPython-Parser/ast", default-features = false, features = ["num-bigint"] } | ||
| #rustpython-format = { path = "../disk/projects/RustPython-Parser/format", default-features = false, features = ["num-bigint"] } | ||
| #rustpython-literal = { path = "../disk/projects/RustPython-Parser/literal", default-features = false } | ||
| #rustpython-parser = { path = "../disk/projects/RustPython-Parser/parser", default-features = false, features = ["full-lexer", "num-bigint"] } |
There was a problem hiding this comment.
i'll remove this before merging
MichaReiser
left a comment
There was a problem hiding this comment.
Nice! What's the plan with the failing tests? Do you plan to comment them out for now? Would it help if I took a look (unlikely to be before Wednesday)?
| if let Some(arg) = arg { | ||
| write!(f, [arg.format(), text("="), value.format()]) | ||
| } else { | ||
| // TODO(konstin): dangling comments after the stars? |
There was a problem hiding this comment.
I don't think that we have to preserve these. It seems a rather weird place to put comments.
| } = item; | ||
| if let Some(argument) = arg { | ||
| write!(f, [argument.format(), text("=")])?; | ||
| if let Some(arg) = arg { |
There was a problem hiding this comment.
Nit: I prefer to move the logic that is common for all branches out of the if. I find that this improves readability. I otherwise have to manually parse both branches to understand what's the same/different.
There was a problem hiding this comment.
i want to keep those two specifically since they are one entry in a list each and because each branch has its own comment handling
| // value . attr | ||
| // ^^^^^^^ the range of dangling comments |
ebf1c09 to
9a63e21
Compare

Summary
This formats call expressions with magic trailing comma and parentheses behaviour but without call chaining
Test Plan
Lots of new test fixtures, including some that don't work yet