Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/biome_css_formatter/src/css/any/page_at_rule_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ impl FormatRule<AnyCssPageAtRuleItem> 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),
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@page :left{
$padding:12px !default;
padding:$padding;

font:{
size:12px;
}

@top-left{
$margin:4px !global;
margin:$margin;
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
}

```
16 changes: 13 additions & 3 deletions crates/biome_css_parser/src/syntax/at_rule/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
}
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: crates/biome_css_parser/tests/spec_test.rs
assertion_line: 208
expression: snapshot
---

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@page :left {
$padding: 12px !default;
padding: $padding;

font: {
size: 12px;
}

@top-left {
$margin: 4px !global;
margin: $margin;
}
}
Loading
Loading