diff --git a/crates/biome_css_formatter/src/css/any/page_at_rule_item.rs b/crates/biome_css_formatter/src/css/any/page_at_rule_item.rs index eaef76d68084..00038a68068f 100644 --- a/crates/biome_css_formatter/src/css/any/page_at_rule_item.rs +++ b/crates/biome_css_formatter/src/css/any/page_at_rule_item.rs @@ -13,6 +13,8 @@ impl FormatRule for FormatAnyCssPageAtRuleItem { AnyCssPageAtRuleItem::CssDeclarationWithSemicolon(node) => node.format().fmt(f), AnyCssPageAtRuleItem::CssEmptyDeclaration(node) => node.format().fmt(f), AnyCssPageAtRuleItem::CssMarginAtRule(node) => node.format().fmt(f), + AnyCssPageAtRuleItem::ScssDeclaration(node) => node.format().fmt(f), + AnyCssPageAtRuleItem::ScssNestingDeclaration(node) => node.format().fmt(f), } } } diff --git a/crates/biome_css_formatter/tests/specs/css/scss/declaration/page-at-rule.scss b/crates/biome_css_formatter/tests/specs/css/scss/declaration/page-at-rule.scss new file mode 100644 index 000000000000..955f2781b432 --- /dev/null +++ b/crates/biome_css_formatter/tests/specs/css/scss/declaration/page-at-rule.scss @@ -0,0 +1,13 @@ +@page :left{ +$padding:12px !default; +padding:$padding; + +font:{ +size:12px; +} + +@top-left{ +$margin:4px !global; +margin:$margin; +} +} diff --git a/crates/biome_css_formatter/tests/specs/css/scss/declaration/page-at-rule.scss.snap b/crates/biome_css_formatter/tests/specs/css/scss/declaration/page-at-rule.scss.snap new file mode 100644 index 000000000000..33c6ea50db92 --- /dev/null +++ b/crates/biome_css_formatter/tests/specs/css/scss/declaration/page-at-rule.scss.snap @@ -0,0 +1,56 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: css/scss/declaration/page-at-rule.scss +--- + +# Input + +```scss +@page :left{ +$padding:12px !default; +padding:$padding; + +font:{ +size:12px; +} + +@top-left{ +$margin:4px !global; +margin:$margin; +} +} + +``` + + +============================= + +# Outputs + +## Output 1 + +----- +Indent style: Tab +Indent width: 2 +Line ending: LF +Line width: 80 +Quote style: Double Quotes +Trailing newline: true +----- + +```scss +@page :left { + $padding: 12px !default; + padding: $padding; + + font: { + size: 12px; + } + + @top-left { + $margin: 4px !global; + margin: $margin; + } +} + +``` diff --git a/crates/biome_css_parser/src/syntax/at_rule/page.rs b/crates/biome_css_parser/src/syntax/at_rule/page.rs index 8bd6bb1c088e..8aa45a48ad63 100644 --- a/crates/biome_css_parser/src/syntax/at_rule/page.rs +++ b/crates/biome_css_parser/src/syntax/at_rule/page.rs @@ -5,13 +5,16 @@ use crate::syntax::at_rule::parse_error::{ }; use crate::syntax::at_rule::{is_at_at_rule, parse_at_rule}; use crate::syntax::block::{ParseBlockBody, parse_declaration_or_at_rule_list_block}; +use crate::syntax::parse_error::scss_only_syntax_error; +use crate::syntax::scss::{is_at_scss_nesting_declaration, parse_scss_nesting_declaration}; use crate::syntax::{ - is_at_any_declaration_with_semicolon, is_at_identifier, is_at_qualified_rule, - parse_any_declaration_with_semicolon, parse_custom_identifier_with_keywords, - parse_qualified_rule, parse_regular_identifier, + CssSyntaxFeatures, is_at_any_declaration_with_semicolon, is_at_identifier, + is_at_qualified_rule, parse_any_declaration_with_semicolon, + parse_custom_identifier_with_keywords, parse_qualified_rule, parse_regular_identifier, }; use biome_css_syntax::CssSyntaxKind::*; use biome_css_syntax::{CssSyntaxKind, T}; +use biome_parser::SyntaxFeature; use biome_parser::parse_lists::{ParseNodeList, ParseSeparatedList}; use biome_parser::parse_recovery::{ParseRecoveryTokenSet, RecoveryResult}; use biome_parser::parsed_syntax::ParsedSyntax::Present; @@ -169,6 +172,7 @@ impl ParseBlockBody for PageBlock { fn is_at_element(&self, p: &mut CssParser) -> bool { at_margin_rule(p) || is_at_at_rule(p) + || is_at_scss_nesting_declaration(p) || is_at_any_declaration_with_semicolon(p) || is_at_qualified_rule(p) } @@ -192,6 +196,12 @@ impl ParseNodeList for PageAtRuleItemList { parse_margin_at_rule(p) } else if is_at_at_rule(p) { parse_at_rule(p) + } else if is_at_scss_nesting_declaration(p) { + CssSyntaxFeatures::Scss.parse_exclusive_syntax( + p, + parse_scss_nesting_declaration, + |p, marker| scss_only_syntax_error(p, "SCSS nesting declarations", marker.range(p)), + ) } else if is_at_any_declaration_with_semicolon(p) { parse_any_declaration_with_semicolon(p) } else if is_at_qualified_rule(p) { diff --git a/crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_page_error.css.snap b/crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_page_error.css.snap index 30b2837ac7cc..6573c6615434 100644 --- a/crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_page_error.css.snap +++ b/crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_page_error.css.snap @@ -1,5 +1,6 @@ --- source: crates/biome_css_parser/tests/spec_test.rs +assertion_line: 208 expression: snapshot --- diff --git a/crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/page.scss b/crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/page.scss new file mode 100644 index 000000000000..22ba60e256c9 --- /dev/null +++ b/crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/page.scss @@ -0,0 +1,13 @@ +@page :left { + $padding: 12px !default; + padding: $padding; + + font: { + size: 12px; + } + + @top-left { + $margin: 4px !global; + margin: $margin; + } +} diff --git a/crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/page.scss.snap b/crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/page.scss.snap new file mode 100644 index 000000000000..1f5e484fe0d0 --- /dev/null +++ b/crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/page.scss.snap @@ -0,0 +1,295 @@ +--- +source: crates/biome_css_parser/tests/spec_test.rs +assertion_line: 208 +expression: snapshot +--- +## Input + +```css +@page :left { + $padding: 12px !default; + padding: $padding; + + font: { + size: 12px; + } + + @top-left { + $margin: 4px !global; + margin: $margin; + } +} + +``` + + +## AST + +``` +CssRoot { + bom_token: missing (optional), + items: CssRootItemList [ + CssAtRule { + at_token: AT@0..1 "@" [] [], + rule: CssPageAtRule { + page_token: PAGE_KW@1..6 "page" [] [Whitespace(" ")], + selectors: CssPageSelectorList [ + CssPageSelector { + ty: missing (optional), + pseudos: CssPageSelectorPseudoList [ + CssPageSelectorPseudo { + colon_token: COLON@6..7 ":" [] [], + selector: CssIdentifier { + value_token: IDENT@7..12 "left" [] [Whitespace(" ")], + }, + }, + ], + }, + ], + block: CssPageAtRuleBlock { + l_curly_token: L_CURLY@12..13 "{" [] [], + items: CssPageAtRuleItemList [ + ScssDeclaration { + name: ScssIdentifier { + dollar_token: DOLLAR@13..17 "$" [Newline("\n"), Whitespace(" ")] [], + name: CssIdentifier { + value_token: IDENT@17..24 "padding" [] [], + }, + }, + colon_token: COLON@24..26 ":" [] [Whitespace(" ")], + value: CssGenericComponentValueList [ + CssRegularDimension { + value_token: CSS_NUMBER_LITERAL@26..28 "12" [] [], + unit_token: IDENT@28..31 "px" [] [Whitespace(" ")], + }, + ], + modifiers: ScssVariableModifierList [ + ScssVariableModifier { + excl_token: BANG@31..32 "!" [] [], + value: DEFAULT_KW@32..39 "default" [] [], + }, + ], + semicolon_token: SEMICOLON@39..40 ";" [] [], + }, + CssDeclarationWithSemicolon { + declaration: CssDeclaration { + property: CssGenericProperty { + name: CssIdentifier { + value_token: IDENT@40..50 "padding" [Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@50..52 ":" [] [Whitespace(" ")], + value: CssGenericComponentValueList [ + ScssIdentifier { + dollar_token: DOLLAR@52..53 "$" [] [], + name: CssIdentifier { + value_token: IDENT@53..60 "padding" [] [], + }, + }, + ], + }, + important: missing (optional), + }, + semicolon_token: SEMICOLON@60..61 ";" [] [], + }, + ScssNestingDeclaration { + name: CssIdentifier { + value_token: IDENT@61..69 "font" [Newline("\n"), Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@69..71 ":" [] [Whitespace(" ")], + value: CssGenericComponentValueList [], + block: CssDeclarationOrRuleBlock { + l_curly_token: L_CURLY@71..72 "{" [] [], + items: CssDeclarationOrRuleList [ + CssDeclarationWithSemicolon { + declaration: CssDeclaration { + property: CssGenericProperty { + name: CssIdentifier { + value_token: IDENT@72..81 "size" [Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@81..83 ":" [] [Whitespace(" ")], + value: CssGenericComponentValueList [ + CssRegularDimension { + value_token: CSS_NUMBER_LITERAL@83..85 "12" [] [], + unit_token: IDENT@85..87 "px" [] [], + }, + ], + }, + important: missing (optional), + }, + semicolon_token: SEMICOLON@87..88 ";" [] [], + }, + ], + r_curly_token: R_CURLY@88..92 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + CssMarginAtRule { + at_token: AT@92..97 "@" [Newline("\n"), Newline("\n"), Whitespace(" ")] [], + name: TOP_LEFT_KW@97..106 "top-left" [] [Whitespace(" ")], + block: CssDeclarationOrAtRuleBlock { + l_curly_token: L_CURLY@106..107 "{" [] [], + items: CssDeclarationOrAtRuleList [ + ScssDeclaration { + name: ScssIdentifier { + dollar_token: DOLLAR@107..113 "$" [Newline("\n"), Whitespace(" ")] [], + name: CssIdentifier { + value_token: IDENT@113..119 "margin" [] [], + }, + }, + colon_token: COLON@119..121 ":" [] [Whitespace(" ")], + value: CssGenericComponentValueList [ + CssRegularDimension { + value_token: CSS_NUMBER_LITERAL@121..122 "4" [] [], + unit_token: IDENT@122..125 "px" [] [Whitespace(" ")], + }, + ], + modifiers: ScssVariableModifierList [ + ScssVariableModifier { + excl_token: BANG@125..126 "!" [] [], + value: GLOBAL_KW@126..132 "global" [] [], + }, + ], + semicolon_token: SEMICOLON@132..133 ";" [] [], + }, + CssDeclarationWithSemicolon { + declaration: CssDeclaration { + property: CssGenericProperty { + name: CssIdentifier { + value_token: IDENT@133..144 "margin" [Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@144..146 ":" [] [Whitespace(" ")], + value: CssGenericComponentValueList [ + ScssIdentifier { + dollar_token: DOLLAR@146..147 "$" [] [], + name: CssIdentifier { + value_token: IDENT@147..153 "margin" [] [], + }, + }, + ], + }, + important: missing (optional), + }, + semicolon_token: SEMICOLON@153..154 ";" [] [], + }, + ], + r_curly_token: R_CURLY@154..158 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@158..160 "}" [Newline("\n")] [], + }, + }, + }, + ], + eof_token: EOF@160..161 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: CSS_ROOT@0..161 + 0: (empty) + 1: CSS_ROOT_ITEM_LIST@0..160 + 0: CSS_AT_RULE@0..160 + 0: AT@0..1 "@" [] [] + 1: CSS_PAGE_AT_RULE@1..160 + 0: PAGE_KW@1..6 "page" [] [Whitespace(" ")] + 1: CSS_PAGE_SELECTOR_LIST@6..12 + 0: CSS_PAGE_SELECTOR@6..12 + 0: (empty) + 1: CSS_PAGE_SELECTOR_PSEUDO_LIST@6..12 + 0: CSS_PAGE_SELECTOR_PSEUDO@6..12 + 0: COLON@6..7 ":" [] [] + 1: CSS_IDENTIFIER@7..12 + 0: IDENT@7..12 "left" [] [Whitespace(" ")] + 2: CSS_PAGE_AT_RULE_BLOCK@12..160 + 0: L_CURLY@12..13 "{" [] [] + 1: CSS_PAGE_AT_RULE_ITEM_LIST@13..158 + 0: SCSS_DECLARATION@13..40 + 0: SCSS_IDENTIFIER@13..24 + 0: DOLLAR@13..17 "$" [Newline("\n"), Whitespace(" ")] [] + 1: CSS_IDENTIFIER@17..24 + 0: IDENT@17..24 "padding" [] [] + 1: COLON@24..26 ":" [] [Whitespace(" ")] + 2: CSS_GENERIC_COMPONENT_VALUE_LIST@26..31 + 0: CSS_REGULAR_DIMENSION@26..31 + 0: CSS_NUMBER_LITERAL@26..28 "12" [] [] + 1: IDENT@28..31 "px" [] [Whitespace(" ")] + 3: SCSS_VARIABLE_MODIFIER_LIST@31..39 + 0: SCSS_VARIABLE_MODIFIER@31..39 + 0: BANG@31..32 "!" [] [] + 1: DEFAULT_KW@32..39 "default" [] [] + 4: SEMICOLON@39..40 ";" [] [] + 1: CSS_DECLARATION_WITH_SEMICOLON@40..61 + 0: CSS_DECLARATION@40..60 + 0: CSS_GENERIC_PROPERTY@40..60 + 0: CSS_IDENTIFIER@40..50 + 0: IDENT@40..50 "padding" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@50..52 ":" [] [Whitespace(" ")] + 2: CSS_GENERIC_COMPONENT_VALUE_LIST@52..60 + 0: SCSS_IDENTIFIER@52..60 + 0: DOLLAR@52..53 "$" [] [] + 1: CSS_IDENTIFIER@53..60 + 0: IDENT@53..60 "padding" [] [] + 1: (empty) + 1: SEMICOLON@60..61 ";" [] [] + 2: SCSS_NESTING_DECLARATION@61..92 + 0: CSS_IDENTIFIER@61..69 + 0: IDENT@61..69 "font" [Newline("\n"), Newline("\n"), Whitespace(" ")] [] + 1: COLON@69..71 ":" [] [Whitespace(" ")] + 2: CSS_GENERIC_COMPONENT_VALUE_LIST@71..71 + 3: CSS_DECLARATION_OR_RULE_BLOCK@71..92 + 0: L_CURLY@71..72 "{" [] [] + 1: CSS_DECLARATION_OR_RULE_LIST@72..88 + 0: CSS_DECLARATION_WITH_SEMICOLON@72..88 + 0: CSS_DECLARATION@72..87 + 0: CSS_GENERIC_PROPERTY@72..87 + 0: CSS_IDENTIFIER@72..81 + 0: IDENT@72..81 "size" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@81..83 ":" [] [Whitespace(" ")] + 2: CSS_GENERIC_COMPONENT_VALUE_LIST@83..87 + 0: CSS_REGULAR_DIMENSION@83..87 + 0: CSS_NUMBER_LITERAL@83..85 "12" [] [] + 1: IDENT@85..87 "px" [] [] + 1: (empty) + 1: SEMICOLON@87..88 ";" [] [] + 2: R_CURLY@88..92 "}" [Newline("\n"), Whitespace(" ")] [] + 3: CSS_MARGIN_AT_RULE@92..158 + 0: AT@92..97 "@" [Newline("\n"), Newline("\n"), Whitespace(" ")] [] + 1: TOP_LEFT_KW@97..106 "top-left" [] [Whitespace(" ")] + 2: CSS_DECLARATION_OR_AT_RULE_BLOCK@106..158 + 0: L_CURLY@106..107 "{" [] [] + 1: CSS_DECLARATION_OR_AT_RULE_LIST@107..154 + 0: SCSS_DECLARATION@107..133 + 0: SCSS_IDENTIFIER@107..119 + 0: DOLLAR@107..113 "$" [Newline("\n"), Whitespace(" ")] [] + 1: CSS_IDENTIFIER@113..119 + 0: IDENT@113..119 "margin" [] [] + 1: COLON@119..121 ":" [] [Whitespace(" ")] + 2: CSS_GENERIC_COMPONENT_VALUE_LIST@121..125 + 0: CSS_REGULAR_DIMENSION@121..125 + 0: CSS_NUMBER_LITERAL@121..122 "4" [] [] + 1: IDENT@122..125 "px" [] [Whitespace(" ")] + 3: SCSS_VARIABLE_MODIFIER_LIST@125..132 + 0: SCSS_VARIABLE_MODIFIER@125..132 + 0: BANG@125..126 "!" [] [] + 1: GLOBAL_KW@126..132 "global" [] [] + 4: SEMICOLON@132..133 ";" [] [] + 1: CSS_DECLARATION_WITH_SEMICOLON@133..154 + 0: CSS_DECLARATION@133..153 + 0: CSS_GENERIC_PROPERTY@133..153 + 0: CSS_IDENTIFIER@133..144 + 0: IDENT@133..144 "margin" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@144..146 ":" [] [Whitespace(" ")] + 2: CSS_GENERIC_COMPONENT_VALUE_LIST@146..153 + 0: SCSS_IDENTIFIER@146..153 + 0: DOLLAR@146..147 "$" [] [] + 1: CSS_IDENTIFIER@147..153 + 0: IDENT@147..153 "margin" [] [] + 1: (empty) + 1: SEMICOLON@153..154 ";" [] [] + 2: R_CURLY@154..158 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@158..160 "}" [Newline("\n")] [] + 2: EOF@160..161 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_css_syntax/src/generated/nodes.rs b/crates/biome_css_syntax/src/generated/nodes.rs index fce8ae51d523..2f98a7e0e993 100644 --- a/crates/biome_css_syntax/src/generated/nodes.rs +++ b/crates/biome_css_syntax/src/generated/nodes.rs @@ -11505,6 +11505,8 @@ pub enum AnyCssPageAtRuleItem { CssDeclarationWithSemicolon(CssDeclarationWithSemicolon), CssEmptyDeclaration(CssEmptyDeclaration), CssMarginAtRule(CssMarginAtRule), + ScssDeclaration(ScssDeclaration), + ScssNestingDeclaration(ScssNestingDeclaration), } impl AnyCssPageAtRuleItem { pub fn as_css_at_rule(&self) -> Option<&CssAtRule> { @@ -11537,6 +11539,18 @@ impl AnyCssPageAtRuleItem { _ => None, } } + pub fn as_scss_declaration(&self) -> Option<&ScssDeclaration> { + match &self { + Self::ScssDeclaration(item) => Some(item), + _ => None, + } + } + pub fn as_scss_nesting_declaration(&self) -> Option<&ScssNestingDeclaration> { + match &self { + Self::ScssNestingDeclaration(item) => Some(item), + _ => None, + } + } } #[derive(Clone, PartialEq, Eq, Hash, Serialize)] pub enum AnyCssPageSelector { @@ -29647,13 +29661,25 @@ impl From for AnyCssPageAtRuleItem { Self::CssMarginAtRule(node) } } +impl From for AnyCssPageAtRuleItem { + fn from(node: ScssDeclaration) -> Self { + Self::ScssDeclaration(node) + } +} +impl From for AnyCssPageAtRuleItem { + fn from(node: ScssNestingDeclaration) -> Self { + Self::ScssNestingDeclaration(node) + } +} impl AstNode for AnyCssPageAtRuleItem { type Language = Language; const KIND_SET: SyntaxKindSet = CssAtRule::KIND_SET .union(CssBogus::KIND_SET) .union(CssDeclarationWithSemicolon::KIND_SET) .union(CssEmptyDeclaration::KIND_SET) - .union(CssMarginAtRule::KIND_SET); + .union(CssMarginAtRule::KIND_SET) + .union(ScssDeclaration::KIND_SET) + .union(ScssNestingDeclaration::KIND_SET); fn can_cast(kind: SyntaxKind) -> bool { matches!( kind, @@ -29662,6 +29688,8 @@ impl AstNode for AnyCssPageAtRuleItem { | CSS_DECLARATION_WITH_SEMICOLON | CSS_EMPTY_DECLARATION | CSS_MARGIN_AT_RULE + | SCSS_DECLARATION + | SCSS_NESTING_DECLARATION ) } fn cast(syntax: SyntaxNode) -> Option { @@ -29673,6 +29701,10 @@ impl AstNode for AnyCssPageAtRuleItem { } CSS_EMPTY_DECLARATION => Self::CssEmptyDeclaration(CssEmptyDeclaration { syntax }), CSS_MARGIN_AT_RULE => Self::CssMarginAtRule(CssMarginAtRule { syntax }), + SCSS_DECLARATION => Self::ScssDeclaration(ScssDeclaration { syntax }), + SCSS_NESTING_DECLARATION => { + Self::ScssNestingDeclaration(ScssNestingDeclaration { syntax }) + } _ => return None, }; Some(res) @@ -29684,6 +29716,8 @@ impl AstNode for AnyCssPageAtRuleItem { Self::CssDeclarationWithSemicolon(it) => it.syntax(), Self::CssEmptyDeclaration(it) => it.syntax(), Self::CssMarginAtRule(it) => it.syntax(), + Self::ScssDeclaration(it) => it.syntax(), + Self::ScssNestingDeclaration(it) => it.syntax(), } } fn into_syntax(self) -> SyntaxNode { @@ -29693,6 +29727,8 @@ impl AstNode for AnyCssPageAtRuleItem { Self::CssDeclarationWithSemicolon(it) => it.into_syntax(), Self::CssEmptyDeclaration(it) => it.into_syntax(), Self::CssMarginAtRule(it) => it.into_syntax(), + Self::ScssDeclaration(it) => it.into_syntax(), + Self::ScssNestingDeclaration(it) => it.into_syntax(), } } } @@ -29704,6 +29740,8 @@ impl std::fmt::Debug for AnyCssPageAtRuleItem { Self::CssDeclarationWithSemicolon(it) => std::fmt::Debug::fmt(it, f), Self::CssEmptyDeclaration(it) => std::fmt::Debug::fmt(it, f), Self::CssMarginAtRule(it) => std::fmt::Debug::fmt(it, f), + Self::ScssDeclaration(it) => std::fmt::Debug::fmt(it, f), + Self::ScssNestingDeclaration(it) => std::fmt::Debug::fmt(it, f), } } } @@ -29715,6 +29753,8 @@ impl From for SyntaxNode { AnyCssPageAtRuleItem::CssDeclarationWithSemicolon(it) => it.into_syntax(), AnyCssPageAtRuleItem::CssEmptyDeclaration(it) => it.into_syntax(), AnyCssPageAtRuleItem::CssMarginAtRule(it) => it.into_syntax(), + AnyCssPageAtRuleItem::ScssDeclaration(it) => it.into_syntax(), + AnyCssPageAtRuleItem::ScssNestingDeclaration(it) => it.into_syntax(), } } } diff --git a/crates/biome_css_syntax/src/lib.rs b/crates/biome_css_syntax/src/lib.rs index ff793a1d1221..d73a68a7ac7e 100644 --- a/crates/biome_css_syntax/src/lib.rs +++ b/crates/biome_css_syntax/src/lib.rs @@ -132,6 +132,7 @@ impl biome_rowan::SyntaxKind for CssSyntaxKind { kind if AnyCssDeclarationOrRuleBlock::can_cast(*kind) => CSS_BOGUS_BLOCK, kind if AnyCssConditionalBlock::can_cast(*kind) => CSS_BOGUS_BLOCK, kind if AnyCssFontFeatureValuesBlock::can_cast(*kind) => CSS_BOGUS_BLOCK, + kind if AnyCssPageAtRuleBlock::can_cast(*kind) => CSS_BOGUS_BLOCK, kind if AnyCssUnicodeValue::can_cast(*kind) => CSS_BOGUS_UNICODE_RANGE_VALUE, kind if AnyCssSupportsCondition::can_cast(*kind) => CSS_BOGUS_SUPPORTS_CONDITION, kind if AnyCssIfBranch::can_cast(*kind) => CSS_BOGUS_IF_BRANCH, diff --git a/xtask/codegen/css.ungram b/xtask/codegen/css.ungram index acdf80159072..9fe9ff12eb14 100644 --- a/xtask/codegen/css.ungram +++ b/xtask/codegen/css.ungram @@ -1369,6 +1369,8 @@ CssPageAtRuleItemList = AnyCssPageAtRuleItem* AnyCssPageAtRuleItem = CssDeclarationWithSemicolon + | ScssDeclaration + | ScssNestingDeclaration | CssEmptyDeclaration | CssAtRule | CssMarginAtRule