feat(css): add support for @debug, @warn, and @error SCSS at-rules#9415
feat(css): add support for @debug, @warn, and @error SCSS at-rules#9415denbezrukov merged 2 commits intomainfrom
@debug, @warn, and @error SCSS at-rules#9415Conversation
|
Parser conformance results onjs/262
jsx/babel
markdown/commonmark
symbols/microsoft
ts/babel
ts/microsoft
|
Merging this PR will not alter performance
Comparing Footnotes
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds full SCSS Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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.
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 | 🟡 MinorGate 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.cssusers 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
⛔ Files ignored due to path filters (13)
crates/biome_css_factory/src/generated/node_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_factory/src/generated/syntax_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_formatter/tests/specs/css/scss/at-rule/debug-warn-error.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/debug.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/error.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/warn.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/debug.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/error.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/warn.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_syntax/src/generated/kind.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_syntax/src/generated/macros.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_syntax/src/generated/nodes_mut.rsis excluded by!**/generated/**,!**/generated/**and included by**
📒 Files selected for processing (27)
crates/biome_css_formatter/src/css/any/at_rule.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/scss/mod.rscrates/biome_css_formatter/src/scss/statements/debug_at_rule.rscrates/biome_css_formatter/src/scss/statements/error_at_rule.rscrates/biome_css_formatter/src/scss/statements/mod.rscrates/biome_css_formatter/src/scss/statements/warn_at_rule.rscrates/biome_css_formatter/tests/specs/css/scss/at-rule/debug-warn-error.scsscrates/biome_css_parser/src/lexer/mod.rscrates/biome_css_parser/src/lexer/tests.rscrates/biome_css_parser/src/syntax/at_rule/mod.rscrates/biome_css_parser/src/syntax/parse_error.rscrates/biome_css_parser/src/syntax/scss/at_rule/debug.rscrates/biome_css_parser/src/syntax/scss/at_rule/error.rscrates/biome_css_parser/src/syntax/scss/at_rule/mod.rscrates/biome_css_parser/src/syntax/scss/at_rule/warn.rscrates/biome_css_parser/src/syntax/scss/mod.rscrates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/debug.scsscrates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/error.scsscrates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/warn.scsscrates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/debug.scsscrates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/error.scsscrates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/warn.scsscrates/biome_grit_patterns/src/grit_target_language/css_target_language/generated_mappings.rscrates/biome_parser/src/lib.rsxtask/codegen/css.ungramxtask/codegen/src/css_kinds_src.rs
Summary
Adds initial support for SCSS-specific statement at-rules:
@debug,@warn, and@error.Test Plan
@debug,@warn, and@errorcases@debug/@warn/@error