feat(css): add support for SCSS @at-root at-rule#9461
Conversation
|
Parser conformance results onjs/262
jsx/babel
markdown/commonmark
symbols/microsoft
ts/babel
ts/microsoft
|
|
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)
WalkthroughAdds comprehensive SCSS Possibly related PRs
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)
📝 Coding Plan for PR comments
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 |
…selector handling
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/at-root.scss (1)
7-9: Add one interpolation-based shorthand fixture.This covers the static selector shorthand, but not the documented
@at-root #{...}form. A small case using interpolation orselector.unify()would pin down the SCSS-specific branch much better than another plain selector example. (sass-lang.com)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/at-root.scss` around lines 7 - 9, Add a new test case that exercises the SCSS interpolation shorthand form of at-root by using the `@at-root` #{...} syntax (or selector.unify()) instead of a plain selector; update the existing at-root fixture to include a line using `@at-root` #{".root-only, .another-root"} (or an equivalent expression built with selector.unify()) so the parser's SCSS-specific branch for interpolation-based shorthand is covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/biome_css_formatter/src/generated.rs`:
- Around line 10385-10409: The generated impls reference a missing module/type:
crate::scss::lists::at_root_query_list::FormatScssAtRootQueryList used for
biome_css_syntax::ScssAtRootQueryList; create or export that formatter (module
at_root_query_list with a public FormatScssAtRootQueryList type implementing the
expected formatting trait) in the scss lists package or update the generated
path to the correct module, then re-run the formatter generator (just
gen-formatter) to regenerate crates/biome_css_formatter/src/generated.rs so the
impls resolve.
In `@crates/biome_css_parser/src/syntax/scss/at_rule/at_root_at_rule.rs`:
- Around line 125-131: Change parse_scss_at_root_selector to return ParsedSyntax
instead of () and only create/complete the node when a selector is actually
parsed: first attempt to predict/parse the selector by invoking
SelectorList::default().parse_list(p) (or using a lookahead) and check its
ParsedSyntax result; if it is Absent then return ParsedSyntax::Absent without
starting or completing a marker (do not call m.complete), otherwise start the
marker, let the successful parse consume tokens, complete the marker with
SCSS_AT_ROOT_SELECTOR and return ParsedSyntax::Present. Ensure you reference the
existing symbols parse_scss_at_root_selector,
SelectorList::default().parse_list, m.complete, and SCSS_AT_ROOT_SELECTOR when
implementing this change so the helper behaves like other ParsedSyntax rules.
---
Nitpick comments:
In `@crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/at-root.scss`:
- Around line 7-9: Add a new test case that exercises the SCSS interpolation
shorthand form of at-root by using the `@at-root` #{...} syntax (or
selector.unify()) instead of a plain selector; update the existing at-root
fixture to include a line using `@at-root` #{".root-only, .another-root"} (or an
equivalent expression built with selector.unify()) so the parser's SCSS-specific
branch for interpolation-based shorthand is covered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 606fa29b-5d20-4c9d-be00-7352322c34ae
⛔ Files ignored due to path filters (9)
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/at-root.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/at-root.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/at-root.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 (20)
crates/biome_css_analyze/src/lint/nursery/use_baseline.rscrates/biome_css_formatter/src/css/any/at_rule.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/scss/auxiliary/at_root_query.rscrates/biome_css_formatter/src/scss/auxiliary/mod.rscrates/biome_css_formatter/src/scss/lists/at_root_query_list.rscrates/biome_css_formatter/src/scss/selectors/at_root_selector.rscrates/biome_css_formatter/src/scss/selectors/mod.rscrates/biome_css_formatter/src/scss/statements/at_root_at_rule.rscrates/biome_css_formatter/src/scss/statements/mod.rscrates/biome_css_formatter/tests/specs/css/scss/at-rule/at-root.scsscrates/biome_css_parser/src/lexer/mod.rscrates/biome_css_parser/src/syntax/at_rule/mod.rscrates/biome_css_parser/src/syntax/scss/at_rule/at_root_at_rule.rscrates/biome_css_parser/src/syntax/scss/at_rule/mod.rscrates/biome_css_parser/src/syntax/scss/mod.rscrates/biome_css_parser/tests/css_test_suite/error/scss/at-rule/at-root.scsscrates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/at-root.scssxtask/codegen/css.ungramxtask/codegen/src/css_kinds_src.rs
crates/biome_css_parser/src/syntax/scss/at_rule/at_root_at_rule.rs
Outdated
Show resolved
Hide resolved
Merging this PR will not alter performance
Comparing Footnotes
|
Summary
Adds support for SCSS
@at-rootTest Plan
cargo test -p biome_css_parser/formatter/analyzer