fix(formatter,oxfmt): Handle nested BinaryExpression for tailwind trailing spaces#20450
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
BinaryExpression for tailwind trailing spaces
Merging this PR will not alter performance
Comparing Footnotes
|
Merge activity
|
…railing spaces (#20450) Fixes #20397 `can_collapse_whitespace()` walks the ancestor chain looking for `BinaryExpression(+)` to determine if boundary whitespace must be preserved. The loop broke on the first non-`BinaryExpression` ancestor, so a `ConditionalExpression` (ternary) between the string and the outer `+` caused an immediate break. So, the `BinaryExpression` was never seen. Prettier's `canCollapseWhitespaceIn()` iterates the entire ancestor path without breaking, reacting only to `BinaryExpression(+)` and `TemplateLiteral` nodes via if checks.
b655cfc to
7c233f4
Compare

Fixes #20397
can_collapse_whitespace()walks the ancestor chain looking forBinaryExpression(+)to determine if boundary whitespace must be preserved.The loop broke on the first non-
BinaryExpressionancestor, so aConditionalExpression(ternary) between the string and the outer+caused an immediate break. So, theBinaryExpressionwas never seen.Prettier's
canCollapseWhitespaceIn()iterates the entire ancestor path without breaking, reacting only toBinaryExpression(+)andTemplateLiteralnodes via if checks.