Skip to content

fix(css/formatter): ratio printing#9251

Merged
ematipico merged 1 commit intomainfrom
fix/ratio-formatter
Feb 27, 2026
Merged

fix(css/formatter): ratio printing#9251
ematipico merged 1 commit intomainfrom
fix/ratio-formatter

Conversation

@ematipico
Copy link
Member

Summary

Closes #9249

It uses the same IR of prettier

Test Plan

Added a test

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Feb 26, 2026

🦋 Changeset detected

Latest commit: ebc9e53

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

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

@ematipico ematipico requested review from a team February 26, 2026 21:19
@github-actions github-actions bot added A-Formatter Area: formatter L-CSS Language: CSS labels Feb 26, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d0b8e6 and ebc9e53.

⛔ Files ignored due to path filters (1)
  • crates/biome_css_formatter/tests/specs/css/ratio/issue_9249.css.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (3)
  • .changeset/fix-css-ratio-formatting.md
  • crates/biome_css_formatter/src/css/value/ratio.rs
  • crates/biome_css_formatter/tests/specs/css/ratio/issue_9249.css

Walkthrough

This PR addresses a CSS formatting issue where ratio values (e.g., 1 / -1) were being incorrectly split across lines when followed by comments. The fix modifies the CSS formatter's ratio handling in ratio.rs to use a format_with and filler-based assembly with soft_line_break_or_space as the separator, replacing the previous format_args! approach. A changeset file and test case for issue #9249 have been added.

Suggested labels

A-Formatter, L-CSS

Suggested reviewers

  • dyc3
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly summarises the main change: fixing CSS formatter's ratio printing behaviour to prevent unwanted line breaks at forward slashes.
Description check ✅ Passed Description appropriately references the linked issue #9249 and explains the fix adopts Prettier's IR approach, with test coverage added.
Linked Issues check ✅ Passed Changes address issue #9249 by modifying ratio formatting logic to prevent line breaks at forward slashes when followed by comments, matching Prettier's behaviour.
Out of Scope Changes check ✅ Passed All changes are tightly scoped to fixing CSS ratio formatting: formatter logic update, test case addition, and corresponding changeset entry.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ratio-formatter

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

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 26, 2026

Merging this PR will not alter performance

✅ 29 untouched benchmarks
⏩ 187 skipped benchmarks1


Comparing fix/ratio-formatter (ebc9e53) with main (2d0b8e6)

Open in CodSpeed

Footnotes

  1. 187 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.

@ematipico ematipico merged commit 59e33fb into main Feb 27, 2026
17 checks passed
@ematipico ematipico deleted the fix/ratio-formatter branch February 27, 2026 16:01
@github-actions github-actions bot mentioned this pull request Feb 27, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

📝 forward slash with comment breaks rule

2 participants