-
-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(css_parser): implement css unknown at rule parsing (#3136)
- Loading branch information
1 parent
2a4d372
commit 32027ee
Showing
49 changed files
with
2,540 additions
and
36,180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
crates/biome_css_formatter/src/css/bogus/unknown_at_rule_component_list.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use crate::FormatBogusNodeRule; | ||
use biome_css_syntax::CssUnknownAtRuleComponentList; | ||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatCssUnknownAtRuleComponentList; | ||
impl FormatBogusNodeRule<CssUnknownAtRuleComponentList> for FormatCssUnknownAtRuleComponentList {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
crates/biome_css_formatter/src/css/statements/unknown_block_at_rule.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use crate::prelude::*; | ||
use biome_css_syntax::{CssUnknownBlockAtRule, CssUnknownBlockAtRuleFields}; | ||
use biome_formatter::write; | ||
|
||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatCssUnknownBlockAtRule; | ||
impl FormatNodeRule<CssUnknownBlockAtRule> for FormatCssUnknownBlockAtRule { | ||
fn fmt_fields(&self, node: &CssUnknownBlockAtRule, f: &mut CssFormatter) -> FormatResult<()> { | ||
let CssUnknownBlockAtRuleFields { | ||
name, | ||
components, | ||
block, | ||
} = node.as_fields(); | ||
|
||
write!(f, [name.format(), space(), components.format()])?; | ||
|
||
if components.map_or(false, |components| components.items().next().is_some()) { | ||
write!(f, [space()])?; | ||
} | ||
|
||
write!(f, [block.format()]) | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
crates/biome_css_formatter/src/css/statements/unknown_value_at_rule.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use crate::prelude::*; | ||
use biome_css_syntax::{CssUnknownValueAtRule, CssUnknownValueAtRuleFields}; | ||
use biome_formatter::write; | ||
|
||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatCssUnknownValueAtRule; | ||
impl FormatNodeRule<CssUnknownValueAtRule> for FormatCssUnknownValueAtRule { | ||
fn fmt_fields(&self, node: &CssUnknownValueAtRule, f: &mut CssFormatter) -> FormatResult<()> { | ||
let CssUnknownValueAtRuleFields { | ||
name, | ||
components, | ||
semicolon_token, | ||
} = node.as_fields(); | ||
|
||
write!(f, [name.format()])?; | ||
|
||
if let Ok(components) = components { | ||
if components.items().next().is_some() { | ||
write!(f, [space()])?; | ||
} | ||
write!(f, [components.format()])?; | ||
} | ||
|
||
write!(f, [semicolon_token.format()]) | ||
} | ||
} |
Oops, something went wrong.