-
-
Notifications
You must be signed in to change notification settings - Fork 839
fix(css-formatter): prefer breaking declaration values at top-level commas #8655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(css-formatter): prefer breaking declaration values at top-level commas #8655
Conversation
🦋 Changeset detectedLatest commit: 6bbe743 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
CodSpeed Performance ReportMerging #8655 will not alter performanceComparing Summary
Footnotes
|
WalkthroughThis change adds a changeset and updates the CSS formatter to break comma-separated declaration values at top-level commas when using the Fill layout. It adds an Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (4 passed)
✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.changeset/curvy-wasps-mix.md (1)
5-5: Consider adding a before/after example.Based on learnings, formatter changesets benefit from showing the visual impact with a diff code block.
Example addition
Biome's CSS formatter now breaks comma-separated declaration values at top-level commas when wrapping. + +Before: +```css +--popover-shadow: 0px 2px 4px 0px var(--shadow, rgba(0, 0, 0, 0.06)), 0px 8px 16px 0px var(--shadow, rgba(0, 0, 0, 0.06)); +``` + +After: +```css +--popover-shadow: + 0px 2px 4px 0px var(--shadow, rgba(0, 0, 0, 0.06)), + 0px 8px 16px 0px var(--shadow, rgba(0, 0, 0, 0.06)); +```
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
crates/biome_css_formatter/tests/specs/css/issue_8636.css.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (3)
.changeset/curvy-wasps-mix.mdcrates/biome_css_formatter/src/utils/component_value_list.rscrates/biome_css_formatter/tests/specs/css/issue_8636.css
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use thedbg!()macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests
Files:
crates/biome_css_formatter/src/utils/component_value_list.rs
🧠 Learnings (11)
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ParseSeparatedList` and `ParseNodeList` for parsing lists with error recovery to avoid infinite loops
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/context.rs : Define `<Language>FormatContext` struct in a `context.rs` file containing `comments` and `source_map` fields, implementing `FormatContext` and `CstFormatContext` traits
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/comments.rs : Define `<Language>CommentStyle` as a public type alias for `Comments<<Language>Language>` in a `comments.rs` file
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use helper functions instead of hardcoding
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Implement the `FormatNodeRule<N>` trait with `fmt_fields` as the only required method; default implementations of `fmt`, `is_suppressed`, `fmt_leading_comments`, `fmt_dangling_comments`, and `fmt_trailing_comments` are provided
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-12-21T21:15:03.796Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: Changesets should describe user-facing changes only; internal refactoring without behavior changes does not require a changeset
Applied to files:
.changeset/curvy-wasps-mix.md
📚 Learning: 2025-12-21T21:15:03.796Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: For formatter changes in changesets, show formatting changes using diff code blocks
Applied to files:
.changeset/curvy-wasps-mix.md
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.
Applied to files:
.changeset/curvy-wasps-mix.md
📚 Learning: 2025-12-21T21:15:03.796Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: Changesets should be concise (1-3 sentences) and provide quick overview of changes without overwhelming details
Applied to files:
.changeset/curvy-wasps-mix.md
🧬 Code graph analysis (1)
crates/biome_css_formatter/src/utils/component_value_list.rs (2)
crates/biome_rowan/src/ast/mod.rs (1)
cast_ref(143-152)crates/biome_formatter/src/builders.rs (3)
soft_line_break_or_space(188-190)format_with(2304-2312)format_once(2381-2389)
🔇 Additional comments (6)
crates/biome_css_formatter/tests/specs/css/issue_8636.css (1)
1-6: Solid test coverage for the comma-breaking behavior.The test cases nicely demonstrate both the multiline comma-breaking behaviour (lines 2-4) and the preservation of inline formatting (line 5).
crates/biome_css_formatter/src/utils/component_value_list.rs (5)
11-20: Clean helper implementation.The function correctly identifies comma delimiters through the AST casting chain.
22-48: Well-gated feature implementation.The three conditions appropriately scope the new behaviour to declaration value lists with commas in Fill layout, with clear comments explaining the rationale.
50-104: Formatter logic is sound.The group-splitting algorithm correctly places commas at the end of each group (lines 61-69), and the nested fill structure (outer fill for groups, inner fill for elements within each group) achieves the desired Prettier-like breaking behaviour.
137-142: Elegant integration with existing logic.The early-return pattern allows the new comma-group behaviour to take precedence for qualifying lists whilst preserving all existing formatting paths.
154-154: Good refactoring to use the new helper.Replacing the inline comma detection with
is_comma_delimiterimproves code reuse and readability.
|
looks like your pr title got cut off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good at a glance, but the docs aren't there yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
.changeset/curvy-wasps-mix.md (1)
5-5: Issue link format should show the issue number.The expected format per project conventions is
Fixed [#8636](url):rather than[Fixed](url):. The issue number should be visible in the text.Based on learnings: "In changesets, start with a link to the issue when fixing a bug (e.g., 'Fixed #4444: ...')".
Suggested fix
-[Fixed](https://github.com/biomejs/biome/issues/8636): Biome's CSS formatter now breaks comma-separated declaration values at top-level commas when wrapping. +Fixed [#8636](https://github.com/biomejs/biome/issues/8636): Biome's CSS formatter now breaks comma-separated declaration values at top-level commas when wrapping.
🧹 Nitpick comments (1)
crates/biome_css_formatter/src/utils/component_value_list.rs (1)
113-126: Consider whether the clone is necessary.The
element.clone()at line 115 works, but depending on the size/cost ofI, you might be able to avoid it by iterating over references differently. For AST node handles this is likely cheap, so not a blocker.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.changeset/curvy-wasps-mix.mdcrates/biome_css_formatter/src/utils/component_value_list.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use thedbg!()macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests
Files:
crates/biome_css_formatter/src/utils/component_value_list.rs
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: Use conventional commit format for commit messages and PR titles, with supported prefixes: build, chore, ci, docs, feat, fix, perf, refactor, release, revert, test
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: For formatter changes in changesets, show formatting changes using diff code blocks
📚 Learning: 2025-12-21T21:15:03.796Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: Changesets should describe user-facing changes only; internal refactoring without behavior changes does not require a changeset
Applied to files:
.changeset/curvy-wasps-mix.md
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.
Applied to files:
.changeset/curvy-wasps-mix.md
📚 Learning: 2025-12-21T21:15:03.796Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: In changesets, start with a link to the issue when fixing a bug (e.g., 'Fixed [#4444](link): ...')
Applied to files:
.changeset/curvy-wasps-mix.md
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ParseSeparatedList` and `ParseNodeList` for parsing lists with error recovery to avoid infinite loops
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use helper functions instead of hardcoding
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/context.rs : Define `<Language>FormatContext` struct in a `context.rs` file containing `comments` and `source_map` fields, implementing `FormatContext` and `CstFormatContext` traits
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Use `Markup!` macro for diagnostic messages and code action descriptions to ensure proper formatting
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-12-21T21:15:03.796Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: For formatter changes in changesets, show formatting changes using diff code blocks
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Test Node.js API
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: autofix
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: End-to-end tests
- GitHub Check: Documentation
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Check Dependencies
🔇 Additional comments (4)
crates/biome_css_formatter/src/utils/component_value_list.rs (4)
11-25: LGTM!Clear helper with good documentation explaining the nested construct limitation. The Option chaining is idiomatic.
27-71: Well documented with CSS examples.The guards are clear, and the rustdoc with before/after CSS samples addresses the previous feedback about needing explanatory comments. The early-return pattern keeps the logic readable.
170-175: Clean integration with early return.The new comma-group path takes precedence when applicable, with a clear fallback to the existing logic. Good use of the helper.
187-187: Good refactor to use the shared helper.
08b5792 to
6bbe743
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
crates/biome_css_formatter/src/utils/component_value_list.rs (1)
11-25: Well-documented helper with clear semantics.The rustdoc explaining nested comma behaviour is particularly helpful for future maintainers.
Minor optional simplification using
is_some_and:🔎 Optional refactor
-fn is_comma_delimiter<I>(node: &I) -> bool -where - I: AstNode<Language = CssLanguage>, -{ - let token_kind = CssGenericDelimiter::cast_ref(node.syntax()) - .and_then(|node| node.value().ok()) - .map(|token| token.kind()); - - matches!(token_kind, Some(CssSyntaxKind::COMMA)) -} +fn is_comma_delimiter<I>(node: &I) -> bool +where + I: AstNode<Language = CssLanguage>, +{ + CssGenericDelimiter::cast_ref(node.syntax()) + .and_then(|node| node.value().ok()) + .is_some_and(|token| token.kind() == CssSyntaxKind::COMMA) +}
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
crates/biome_css_formatter/tests/specs/css/issue_8636.css.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (3)
.changeset/curvy-wasps-mix.mdcrates/biome_css_formatter/src/utils/component_value_list.rscrates/biome_css_formatter/tests/specs/css/issue_8636.css
🚧 Files skipped from review as they are similar to previous changes (2)
- .changeset/curvy-wasps-mix.md
- crates/biome_css_formatter/tests/specs/css/issue_8636.css
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use thedbg!()macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests
Files:
crates/biome_css_formatter/src/utils/component_value_list.rs
🧠 Learnings (8)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: For formatter changes in changesets, show formatting changes using diff code blocks
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ParseSeparatedList` and `ParseNodeList` for parsing lists with error recovery to avoid infinite loops
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use helper functions instead of hardcoding
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/context.rs : Define `<Language>FormatContext` struct in a `context.rs` file containing `comments` and `source_map` fields, implementing `FormatContext` and `CstFormatContext` traits
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2026-01-02T14:58:16.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.536Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Use `Markup!` macro for diagnostic messages and code action descriptions to ensure proper formatting
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-12-21T21:15:03.796Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: For formatter changes in changesets, show formatting changes using diff code blocks
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
📚 Learning: 2025-12-21T21:15:03.796Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: Applies to **/*.rs : Use inline rustdoc documentation for rules, assists, and their options
Applied to files:
crates/biome_css_formatter/src/utils/component_value_list.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Check Dependencies
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Documentation
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: End-to-end tests
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test Node.js API
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: autofix
🔇 Additional comments (4)
crates/biome_css_formatter/src/utils/component_value_list.rs (4)
27-71: Solid implementation with appropriate guards.The rustdoc with before/after CSS examples is excellent — makes the intent crystal clear. The guard conditions correctly scope this behaviour to declaration values only, preventing unintended side effects elsewhere.
109-130: Logic is correct, but consider the clone overhead.Line 115 clones each element to satisfy
into_format's ownership requirement. For typical CSS values this should be negligible, but worth noting.The separator logic at lines 119-122 correctly avoids inserting a space before commas — good attention to detail.
170-175: Clean integration with helpful inline comment.The early return pattern keeps the existing logic untouched for non-comma-separated values. Good use of the new helper.
187-187: Consistent use of the new helper.Replacing the inline token-kind check with
is_comma_delimiterimproves consistency across the file.
dyc3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it, thank you!
Summary
Closes #8636.
Fixed wrapping of comma-separated declaration values so Biome prefers breaking at top-level commas (Prettier-like), instead of wrapping inside a comma-group.
Repro
What changed
ValueListLayout::Fill, declaration values with top-level commas are now formatted as “comma-groups” so wrapping prefers the comma boundary.--popover-shadow(multiline and single-line input variants).Tests
just formatjust lintjust testAI assistance disclosure
This PR was written with AI assistance (Cursor + GPT). The implementation and refactors were reviewed and adjusted manually.