Skip to content

feat(css): add support for @debug, @warn, and @error SCSS at-rules#9415

Merged
denbezrukov merged 2 commits intomainfrom
db/scss-at-rule-1
Mar 9, 2026
Merged

feat(css): add support for @debug, @warn, and @error SCSS at-rules#9415
denbezrukov merged 2 commits intomainfrom
db/scss-at-rule-1

Conversation

@denbezrukov
Copy link
Contributor

Summary

Adds initial support for SCSS-specific statement at-rules: @debug, @warn, and @error.

Test Plan

  • Added parser coverage for valid and invalid SCSS @debug, @warn, and @error cases
  • Added formatter coverage for SCSS @debug / @warn / @error

@changeset-bot
Copy link

changeset-bot bot commented Mar 9, 2026

⚠️ No Changeset found

Latest commit: 0b77f91

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 Mar 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 53009 53009 0
Passed 51789 51789 0
Failed 1178 1178 0
Panics 42 42 0
Coverage 97.70% 97.70% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 38 38 0
Passed 37 37 0
Failed 1 1 0
Panics 0 0 0
Coverage 97.37% 97.37% 0.00%

markdown/commonmark

Test result main count This PR count Difference
Total 652 652 0
Passed 652 652 0
Failed 0 0 0
Panics 0 0 0
Coverage 100.00% 100.00% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 5466 5466 0
Passed 1915 1915 0
Failed 3551 3551 0
Panics 0 0 0
Coverage 35.03% 35.03% 0.00%

ts/babel

Test result main count This PR count Difference
Total 636 636 0
Passed 568 568 0
Failed 68 68 0
Panics 0 0 0
Coverage 89.31% 89.31% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18875 18875 0
Passed 13014 13014 0
Failed 5860 5860 0
Panics 1 1 0
Coverage 68.95% 68.95% 0.00%

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 9, 2026

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 156 skipped benchmarks1


Comparing db/scss-at-rule-1 (0b77f91) with main (0536fd3)

Open in CodSpeed

Footnotes

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

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: f50f572f-ee8d-47ea-a1d8-737f972d6d85

📥 Commits

Reviewing files that changed from the base of the PR and between 79f0e86 and 0b77f91.

📒 Files selected for processing (1)
  • crates/biome_css_parser/src/syntax/at_rule/mod.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_css_parser/src/syntax/at_rule/mod.rs

Walkthrough

Adds full SCSS @debug, @warn and @error support across the codebase: lexer keyword tokens, parsing helpers and a shared expression-at-rule parser, AST/grammar additions, formatter implementations and wiring, codegen updates, and test cases (both ok and error suites). Also adds a SyntaxFeature helper method used for conditional parsing.

Suggested labels

L-SCSS

Suggested reviewers

  • ematipico
  • siketyan
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: adding support for three SCSS at-rules (@debug, @warn, @error).
Description check ✅ Passed The description is directly related to the changeset, clearly stating the addition of SCSS at-rule support with test coverage details.

✏️ 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 db/scss-at-rule-1

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/biome_css_parser/src/syntax/parse_error.rs (1)

185-213: ⚠️ Potential issue | 🟡 Minor

Gate SCSS-only at-rule suggestions by file type.

expected_any_at_rule() feeds generic at-rule diagnostics, so adding "debug", "warn", and "error" unconditionally will now tell plain .css users those names are expected too. Please only include them when the parser is in SCSS mode; otherwise the hint becomes a bit cheeky and a bit wrong.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_css_parser/src/syntax/parse_error.rs` around lines 185 - 213,
The current expected_any_at_rule function always includes SCSS-only at-rules
("debug", "warn", "error"); update it to conditionally include those three names
only when the parser is in SCSS mode: inside expected_any_at_rule (referencing
CssParser p) build the list of at-rule names into a mutable Vec<&str>, push the
SCSS-only strings only if p indicates SCSS mode (call the parser's SCSS-checking
accessor such as p.is_scss() or p.syntax.is_scss()), then pass that Vec (or
slice) to expect_one_of(...) and .into_diagnostic(p) so plain .css parsing does
not get SCSS-specific suggestions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@crates/biome_css_parser/src/syntax/parse_error.rs`:
- Around line 185-213: The current expected_any_at_rule function always includes
SCSS-only at-rules ("debug", "warn", "error"); update it to conditionally
include those three names only when the parser is in SCSS mode: inside
expected_any_at_rule (referencing CssParser p) build the list of at-rule names
into a mutable Vec<&str>, push the SCSS-only strings only if p indicates SCSS
mode (call the parser's SCSS-checking accessor such as p.is_scss() or
p.syntax.is_scss()), then pass that Vec (or slice) to expect_one_of(...) and
.into_diagnostic(p) so plain .css parsing does not get SCSS-specific
suggestions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4bdd68f7-7a8d-45c3-9a40-bf741c58b06c

📥 Commits

Reviewing files that changed from the base of the PR and between 0536fd3 and 79f0e86.

⛔ Files ignored due to path filters (13)
  • 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/css/scss/at-rule/debug-warn-error.scss.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/debug.scss.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/error.scss.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/warn.scss.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/debug.scss.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/error.scss.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/warn.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 (27)
  • crates/biome_css_formatter/src/css/any/at_rule.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/biome_css_formatter/src/scss/mod.rs
  • crates/biome_css_formatter/src/scss/statements/debug_at_rule.rs
  • crates/biome_css_formatter/src/scss/statements/error_at_rule.rs
  • crates/biome_css_formatter/src/scss/statements/mod.rs
  • crates/biome_css_formatter/src/scss/statements/warn_at_rule.rs
  • crates/biome_css_formatter/tests/specs/css/scss/at-rule/debug-warn-error.scss
  • crates/biome_css_parser/src/lexer/mod.rs
  • crates/biome_css_parser/src/lexer/tests.rs
  • crates/biome_css_parser/src/syntax/at_rule/mod.rs
  • crates/biome_css_parser/src/syntax/parse_error.rs
  • crates/biome_css_parser/src/syntax/scss/at_rule/debug.rs
  • crates/biome_css_parser/src/syntax/scss/at_rule/error.rs
  • crates/biome_css_parser/src/syntax/scss/at_rule/mod.rs
  • crates/biome_css_parser/src/syntax/scss/at_rule/warn.rs
  • crates/biome_css_parser/src/syntax/scss/mod.rs
  • crates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/debug.scss
  • crates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/error.scss
  • crates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/warn.scss
  • crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/debug.scss
  • crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/error.scss
  • crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/warn.scss
  • crates/biome_grit_patterns/src/grit_target_language/css_target_language/generated_mappings.rs
  • crates/biome_parser/src/lib.rs
  • xtask/codegen/css.ungram
  • xtask/codegen/src/css_kinds_src.rs

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