Skip to content

feat(css_formatter): improve handling of SCSS @at-root selector comments and formatting - #10160

Merged
denbezrukov merged 2 commits into
mainfrom
db/scss-formatter-2
Apr 29, 2026
Merged

denbezrukov merged 2 commits into
mainfrom
db/scss-formatter-2

Conversation

@denbezrukov

Copy link
Copy Markdown
Contributor

This PR was implemented with assistance from Codex.

Summary

Align SCSS @at-root comment formatting with Prettier.

Example output:

@at-root .foo
// .bar
{
}

@at-root // .bar
.foo {
}

Test Plan

cargo test -p biome_css_formatter

@changeset-bot

changeset-bot Bot commented Apr 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2552a46

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 Apr 29, 2026
@coderabbitai

coderabbitai Bot commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

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: b59a0d34-9fff-4d29-89b3-d40c9364b6df

📥 Commits

Reviewing files that changed from the base of the PR and between 2552a46 and c51c1ea.

📒 Files selected for processing (1)
  • crates/biome_css_formatter/src/comments.rs

Walkthrough

Adds SCSS-specific comment handling and formatting tweaks for @at-root rules. place_comment now tries handle_scss_at_root_selector_comment first for standalone line comments adjacent to an ScssAtRootSelector inside an ScssAtRootAtRule; if the corresponding @at-root block is resolved, the comment is placed as that block’s leading comment, otherwise fallback to default. Formatting for ScssAtRootAtRule now emits a hard line break before the rule block when trailing or leading line comments are present; tests for multi-line @at-root selectors with interleaved comments were added.

Possibly related PRs

Suggested reviewers

  • ematipico
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: improving SCSS @at-root comment handling and formatting to align with Prettier.
Description check ✅ Passed The description clearly relates to the changeset, explaining the alignment with Prettier's formatting for @at-root comments and providing concrete examples.
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-formatter-2

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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

@codspeed

codspeed Bot commented Apr 29, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 29 untouched benchmarks
⏩ 227 skipped benchmarks1


Comparing db/scss-formatter-2 (c51c1ea) with main (6677ac6)

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 8386dd0 into main Apr 29, 2026
28 checks passed
@denbezrukov
denbezrukov deleted the db/scss-formatter-2 branch April 29, 2026 19:29
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