feat(css): add support for sass() in SCSS conditional expressions#9414
feat(css): add support for sass() in SCSS conditional expressions#9414denbezrukov merged 4 commits intomainfrom
sass() in SCSS conditional expressions#9414Conversation
|
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 ignored due to path filters (5)
📒 Files selected for processing (3)
💤 Files with no reviewable changes (3)
WalkthroughAdds 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)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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.
Actionable comments posted: 1
🤖 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_parser/src/syntax/scss/expression/mod.rs`:
- Around line 63-70: The recovery logic must also stop before variable modifiers
so modifiers like "!default" / "!global" aren't consumed into a malformed
expression: update the recovery boundary to mirror variable_value's boundary
(i.e., respect stops_before_variable_modifiers). Specifically, modify the
recovery path that currently uses recovery_end_ts() so it checks for variable
modifiers and treats them as stopping tokens (or pass the same end_ts that
includes that stop), and apply the same change to the other analogous
constructor(s) referenced around lines 91-93; refer to variable_value,
recovery_end_ts, and the stops_before_variable_modifiers flag when locating
where to add the stop-for-modifiers check.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4c76c3bf-7179-407e-8692-bb8c1199d771
⛔ Files ignored due to path filters (10)
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/expression/edge-cases.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/function/if.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/scss/value/if-disambiguation.scss.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/scss/value/list-important-item.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 (21)
crates/biome_css_formatter/src/css/any/if_test.rscrates/biome_css_formatter/src/css/auxiliary/if_sass_test.rscrates/biome_css_formatter/src/css/auxiliary/mod.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/tests/specs/css/scss/expression/edge-cases.scsscrates/biome_css_parser/src/lexer/mod.rscrates/biome_css_parser/src/lexer/tests.rscrates/biome_css_parser/src/syntax/scss/declaration/mod.rscrates/biome_css_parser/src/syntax/scss/declaration/variable.rscrates/biome_css_parser/src/syntax/scss/declaration/variable_modifier.rscrates/biome_css_parser/src/syntax/scss/expression/list.rscrates/biome_css_parser/src/syntax/scss/expression/mod.rscrates/biome_css_parser/src/syntax/scss/mod.rscrates/biome_css_parser/src/syntax/value/function/call.rscrates/biome_css_parser/src/syntax/value/if.rscrates/biome_css_parser/tests/css_test_suite/error/function/if.csscrates/biome_css_parser/tests/css_test_suite/ok/scss/value/if-disambiguation.scsscrates/biome_css_parser/tests/css_test_suite/ok/scss/value/list-important-item.scsscrates/biome_grit_patterns/src/grit_target_language/css_target_language/generated_mappings.rsxtask/codegen/css.ungramxtask/codegen/src/css_kinds_src.rs
Summary
Improves SCSS expression parsing for two Sass syntax gaps.
Biome now keeps unparenthesized
!importantinside SCSS variable values instead of misparsing itas a variable modifier, and it recognizes
if(sass(...): ...; else: ...;)in SCSS files.Test Plan
new tests