Skip to content

feat(css): support dynamic supports heads - #12127

Merged
denbezrukov merged 3 commits into
mainfrom
dbezrukov/scss-supports-dynamic-heads
Oct 4, 2026
Merged

denbezrukov merged 3 commits into
mainfrom
dbezrukov/scss-supports-dynamic-heads

Conversation

@denbezrukov

Copy link
Copy Markdown
Contributor

This PR was developed with assistance from OpenAI Codex.

Summary

Adds parser and formatter support for dynamic SCSS @supports heads.

$property: display;
$condition: "(display: grid)";

@supports ($property: grid) {
  .by-name {
    display: grid;
  }
}

@supports (#{$condition}) {
  .by-condition {
    display: grid;
  }
}

@supports (#{$condition} and (color: red)) {
  .combined {
    display: grid;
  }
}

Test Plan

  • cargo test -p biome_css_parser/formatter

@agentscanapp

agentscanapp Bot commented Oct 4, 2026

Copy link
Copy Markdown

A maintainer will take a look as soon as they can. In the meantime, please make sure that:

  • the description follows our PR template
  • any related issues are linked
  • existing tests still pass

@changeset-bot

changeset-bot Bot commented Oct 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d4a34f6

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-Parser Area: parser A-Formatter Area: formatter A-Tooling Area: internal tools L-CSS Language: CSS and super languages L-Grit Language: GritQL labels Oct 4, 2026
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Parser conformance results

scss/sass-spec

Test result main count This PR count Difference
Total 11463 11463 0
Passed 11080 11082 ✅ ⏫ +2
Failed 383 381 ✅ ⏬ -2
Panics 0 0 0
Coverage 96.66% 96.68% +0.02%
🎉 Fixed (2):
css/supports/syntax/lone_interpolation/parens/alone
css/supports/syntax/lone_interpolation/parens/before_operator

@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: biomejs/biome/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 431e40bc-2e5a-4639-993f-73e84bff66e6
📥 Commits

Reviewing files that changed from the base of the PR and between f9977d9 and d4a34f6.

⛔ Files ignored due to path filters (12)
  • crates/biome_css_factory/src/generated/node_factory.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_factory/src/generated/syntax_factory.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_formatter/tests/specs/scss/at-rule/parity-supports-dynamic-heads.scss.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/parity-supports-dynamic-heads.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/parity-supports-dynamic-heads.scss.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/supports-interpolated-property-missing-colon.scss.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/parity-supports-dynamic-heads.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/parity-supports-dynamic-heads.scss.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_syntax/src/generated/kind.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_syntax/src/generated/macros.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_syntax/src/generated/nodes.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_syntax/src/generated/nodes_mut.rs is excluded by !**/generated/**, !**/generated/** and included by **
📒 Files selected for processing (14)
  • crates/biome_css_formatter/src/css/any/supports_in_parens.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/biome_css_formatter/src/scss/auxiliary/mod.rs
  • crates/biome_css_formatter/src/scss/auxiliary/supports_feature_declaration.rs
  • crates/biome_css_formatter/tests/specs/scss/at-rule/parity-supports-dynamic-heads.scss
  • crates/biome_css_parser/src/syntax/at_rule/supports/mod.rs
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/parity-supports-dynamic-heads.css
  • crates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/parity-supports-dynamic-heads.scss
  • crates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/supports-interpolated-property-missing-colon.scss
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/parity-supports-dynamic-heads.css
  • crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/parity-supports-dynamic-heads.scss
  • crates/biome_grit_patterns/src/grit_target_language/css_target_language/generated_mappings.rs
  • xtask/codegen/css.ungram
  • xtask/codegen/src/css_kinds_src.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The parser now handles SCSS variables and interpolated heads in @supports conditions. The change adds a syntax node for variable-based supports declarations and formatter support for that node. New parser and formatter fixtures cover valid forms and error cases.

Suggested reviewers: ematipico

Priority: ⬇️ Low

Change: Feature

Merge Risk: ⚪ Minimal · up to d4a34

The investigated parser and formatter cases preserve the expected behavior. No identified issue prevents merging after normal checks.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to d4a34

The examined changes add parsing and formatting support for dynamic SCSS conditions while preserving language-mode checks. No material security risk introduced or worsened by this change was identified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The reviewed reachability expansion is source text reaching additional syntax nodes and their formatting consumers. The inspected branches and adapters do not introduce interpolation execution, external operations, or additional privileges. Exposure through unexamined hosting environments is not established by this evidence.

Trust Boundaries and Controls

  • inferred — The relevant control is a language-mode and syntax-classification boundary, not an authentication boundary. Attacker-supplied interpolation remains parsed syntax in the examined paths, and formatter access is through typed nodes and the existing formatting context.

Resilience and Maintainability Implications

  • observed — The direct supports interpolation parser owns its opening delimiter, reports an absent head, and expects a closing delimiter on its completion paths. Condition continuation retains existing chain recovery, while the variable-declaration branch explicitly expects its colon and closing parenthesis. Inspection found no new progress or parser-state ownership defect in these paths; runtime behavior was not tested.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarises the main change: support for dynamic SCSS @supports heads.
Description check ✅ Passed The description explains the parser and formatter support and gives relevant SCSS examples and a test plan.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@codspeed

codspeed Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

⚠️ 3 benchmarks measured no execution time

Nothing ran under measurement, usually because the compiler removed the code under test. These results are not comparable, so they count as unchanged.

Preventing compiler optimizations

✅ 114 untouched benchmarks
⏩ 299 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚠️ grit_query_anchor_kinds[code_snippet] < 1 ns < 1 ns N/A
⚠️ grit_query_anchor_kinds[metavariable] < 1 ns < 1 ns N/A
⚠️ grit_query_anchor_kinds[or_pattern] < 1 ns < 1 ns N/A

Comparing dbezrukov/scss-supports-dynamic-heads (d4a34f6) with main (f9977d9)2

Open in CodSpeed

Footnotes

  1. 299 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. ↩

  2. No successful run was found on main (a1463aa) during the generation of this report, so f9977d9 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@denbezrukov
denbezrukov merged commit 74af6b1 into main Oct 4, 2026
36 checks passed
@denbezrukov
denbezrukov deleted the dbezrukov/scss-supports-dynamic-heads branch October 4, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Formatter Area: formatter A-Parser Area: parser A-Tooling Area: internal tools L-CSS Language: CSS and super languages L-Grit Language: GritQL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants