Commits
Click on a commit to change the comparison rangeadd a couple more test cases
I tried to get Claude to come up with tests, but most of them weren't very
interesting. I think these two additional types of assignments might be worth
having, though. add too-eagerly parenthesized case from ecosystem
the initial code here is only 83 characters wide, so the call expression should
fit without wrapping the whole body in parens fix snapshot changes for cases with comments fix another ecosystem call expansion add wrapping case from the ecosystem check
the lambda is hugging its enclosing parentheses when it shouldn't be. there
seems to be an issue with `best_fitting!` because moving any of the options
we're passing to it out of `best_fitting!` avoids this behavior.
IR:
```
[
source_position(0),
source_position(1),
"[",
group(expand: propagated, [
indent([
soft_line_break,
"(",
group([
indent([
soft_line_break,
"lambda ",
group(["eval_df, _"]),
": ",
best_fitting([
[
[
<interned 0> [
"MetricValue(",
group(expand: propagated, [
indent([
soft_line_break,
group(expand: propagated, [
"scores=eval_df[",
group([
indent([soft_line_break, "\"prediction\""]),
soft_line_break
]),
"].tolist",
group(["()"]),
",",
soft_line_break_or_space,
"aggregate_results={",
group([
indent([
soft_line_break,
group([
"\"prediction_sum\": sum(",
group([
indent([
soft_line_break,
group([
"eval_df[",
group([
indent([soft_line_break, "\"prediction\""]),
soft_line_break
]),
"]"
])
]),
soft_line_break
]),
")"
])
]),
soft_line_break
]),
"}",
if_group_breaks([","]),
expand_parent
])
]),
soft_line_break
]),
")"
]
]
]
[[group(expand: true, [<ref interned *0>])]]
[
[
"(",
indent([hard_line_break, <ref interned *0>]),
hard_line_break,
")"
]
]
])
]),
soft_line_break
]),
")",
if_group_breaks([","]),
expand_parent
]),
soft_line_break
]),
"]",
source_position(196),
hard_line_break,
source_position(196)
]
``` remove comment
I don't think we can move the `fits_expanded` call into the assignment
formatting because that would wrap the whole lambda in a `fits_expanded`, when we
just want to wrap the lambda body in it instead. if I understand correctly, we'd
need to duplicate basically this whole function to inject `fits_expanded` in the
right place for the lambda formatting in assignments Merge branch 'main' into brent/indent-lambda-params mirror comment handling from `maybe_parenthesize_expression`
and update comment improve dangling header comment placement fix assignment instability without parameters too format new dangling comments Merge branch 'main' into brent/indent-lambda-params