Skip to content

fix(css_formatter): preserve blank lines between SCSS map pairs - #10427

Merged
denbezrukov merged 3 commits into
mainfrom
db/scss-formattter-24
May 21, 2026
Merged

denbezrukov merged 3 commits into
mainfrom
db/scss-formattter-24

Conversation

@denbezrukov

Copy link
Copy Markdown
Contributor

Summary

Preserve source blank lines between SCSS map pairs.

$leadingBlockCommentMap: (
	/* comment */ key1: value,

	key2: value,
);

$leadingBlockCommentsMap: (
	/* comment */ /* comment */ key2: value,

	key3: value,
);

Test Plan

  • cargo test -p biome_css_formatter

@changeset-bot

changeset-bot Bot commented May 20, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 88c7929

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added A-Formatter Area: formatter L-CSS Language: CSS and super languages labels May 20, 2026
@coderabbitai

coderabbitai Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fa0614c3-8a2b-49e4-b2bf-afde6c157654

📥 Commits

Reviewing files that changed from the base of the PR and between fe62d9a and 88c7929.

📒 Files selected for processing (1)
  • crates/biome_css_formatter/src/scss/auxiliary/each_header.rs

Walkthrough

This PR converts several SCSS formatter helpers from formatter-producing fragments to writer-style helpers and refactors map-pair list formatting. It adds AstSeparatedList and changes map-pair joining to build a separated comma list (no trailing comma) then join elements with soft-line logic to preserve original blank lines. Related writer helpers were added for broken map pairs, parenthesised trailing commas, closing comments, include lists and non-empty map layout; tests were updated.

Possibly related PRs

  • biomejs/biome#10076: Prior work on SCSS map pair list formatting and trailing-separator handling.
  • biomejs/biome#10417: Overlapping refactor of map-pair value formatting in scss/auxiliary/map_expression_pair.rs.
  • biomejs/biome#10216: Related changes to SCSS map pair formatting and broken key/value layout in map_expression_pair.rs.

Suggested reviewers

  • ematipico
  • dyc3
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title precisely describes the main change: preserving blank lines between SCSS map pairs in the CSS formatter.
Description check ✅ Passed The description clearly relates to the changeset, providing concrete examples of SCSS maps with blank lines and comments that should be preserved.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch db/scss-formattter-24

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed

codspeed Bot commented May 20, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 29 untouched benchmarks
⏩ 227 skipped benchmarks1


Comparing db/scss-formattter-24 (88c7929) with main (b3840a2)

Open in CodSpeed

Footnotes

  1. 227 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@denbezrukov
denbezrukov merged commit 73ab389 into main May 21, 2026
30 checks passed
@denbezrukov
denbezrukov deleted the db/scss-formattter-24 branch May 21, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Formatter Area: formatter L-CSS Language: CSS and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants