feat(css_formatter): improve SCSS map value and pair formatting for better readability - #10216
Conversation
…etter readability
|
WalkthroughThis PR simplifies SCSS map expression pair formatting by removing conditional branching based on context (e.g., whether a node is within a map key or include arguments). The formatter now applies a unified two-branch approach: if the child value is self-breaking, it maintains Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/biome_css_formatter/tests/specs/scss/expression/map-pair-wrapping.scss (1)
1-2: ⚡ Quick winConsider adding a self-breaking value case to the fixture.
The current input only exercises the non-self-breaking wrap path. The other branch — where the value is a nested map or parenthesised list and the pair stays as
key: (…)on one line — isn't covered here. A second$mapentry (or a separate variable) with a nested map value would give the snapshot full coverage of both branches.💡 Example addition
$map:(very-very-very-very-very-very-very-verylong-key:very-very-very-very-very-very-very-verylong-value,other-key:other-value); +$nested:(self-breaking-key:(inner-key:inner-value));🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_css_formatter/tests/specs/scss/expression/map-pair-wrapping.scss` around lines 1 - 2, Add a second test case that exercises the self-breaking value path by adding another Sass map variable or an additional entry in the existing $map where the value is a nested map or a parenthesised list (e.g. key: (nested-key: nested-value) or key: (a, b, c)), so the formatter must keep the pair as `key: (…)` on one line; update the fixture (variable name like $map or add $map2) with that nested-map/parenthesised-list value to ensure both non-self-breaking and self-breaking branches are covered in the snapshot.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@crates/biome_css_formatter/tests/specs/scss/expression/map-pair-wrapping.scss`:
- Around line 1-2: Add a second test case that exercises the self-breaking value
path by adding another Sass map variable or an additional entry in the existing
$map where the value is a nested map or a parenthesised list (e.g. key:
(nested-key: nested-value) or key: (a, b, c)), so the formatter must keep the
pair as `key: (…)` on one line; update the fixture (variable name like $map or
add $map2) with that nested-map/parenthesised-list value to ensure both
non-self-breaking and self-breaking branches are covered in the snapshot.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5e8b2e98-7762-4bfd-b2e2-a96d301c7347
⛔ Files ignored due to path filters (9)
crates/biome_css_formatter/tests/specs/prettier/scss/map/2554.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_formatter/tests/specs/prettier/scss/map/function-argument/function-argument-2.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_formatter/tests/specs/prettier/scss/map/function-argument/functional-argument.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_formatter/tests/specs/prettier/scss/map/key-values.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_formatter/tests/specs/prettier/scss/map/keys.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_formatter/tests/specs/scss/expression/map-context.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_formatter/tests/specs/scss/expression/map-expansion.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_formatter/tests/specs/scss/expression/map-pair-wrapping.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_formatter/tests/specs/scss/expression/map-values.scss.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (2)
crates/biome_css_formatter/src/scss/auxiliary/map_expression_pair.rscrates/biome_css_formatter/tests/specs/scss/expression/map-pair-wrapping.scss
Merging this PR will not alter performance
Comparing Footnotes
|
Summary
Improves SCSS map formatting so long map pairs can wrap after the colon instead of exceeding the configured line width.
Test Plan