Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(formatter): format @starting-style #2213

Merged
merged 1 commit into from
Mar 26, 2024
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
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
use crate::prelude::*;
use biome_css_syntax::CssStartingStyleAtRule;
use biome_rowan::AstNode;
use biome_css_syntax::{CssStartingStyleAtRule, CssStartingStyleAtRuleFields};
use biome_formatter::write;

#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssStartingStyleAtRule;
impl FormatNodeRule<CssStartingStyleAtRule> for FormatCssStartingStyleAtRule {
fn fmt_fields(&self, node: &CssStartingStyleAtRule, f: &mut CssFormatter) -> FormatResult<()> {
format_verbatim_node(node.syntax()).fmt(f)
let CssStartingStyleAtRuleFields {
starting_style_token,
block,
} = node.as_fields();
write!(f, [starting_style_token.format(), space(), block.format()])
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@starting-style {
h1 {
background-color: transparent;
}


@layer foo {
@starting-style {
background-color: transparent;
}

div {


height: 100px;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
source: crates/biome_formatter_test/src/snapshot_builder.rs
info: css/atrule/starting_style.css
---
# Input

```css
@starting-style {
h1 {
background-color: transparent;
}


@layer foo {
@starting-style {
background-color: transparent;
}

div {


height: 100px;
}
}
}

```


=============================

# Outputs

## Output 1

-----
Indent style: Tab
Indent width: 2
Line ending: LF
Line width: 80
Quote style: Double Quotes
-----

```css
@starting-style {
h1 {
background-color: transparent;
}

@layer foo {
@starting-style {
background-color: transparent;
}

div {
height: 100px;
}
}
}
```
Loading