Skip to content

Commit

Permalink
feat(css_parser): add :local and :global pseudo class. #3011
Browse files Browse the repository at this point in the history
  • Loading branch information
denbezrukov committed May 28, 2024
1 parent 1e813c6 commit 1fbc42e
Show file tree
Hide file tree
Showing 58 changed files with 3,247 additions and 502 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 51 additions & 1 deletion crates/biome_css_factory/src/generated/node_factory.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 94 additions & 1 deletion crates/biome_css_factory/src/generated/syntax_factory.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/biome_css_formatter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ biome_rowan = { workspace = true }
biome_suppression = { workspace = true }

[dev-dependencies]
biome_configuration = { workspace = true }
biome_css_parser = { path = "../biome_css_parser" }
biome_formatter_test = { path = "../biome_formatter_test" }
biome_parser = { path = "../biome_parser" }
Expand Down
15 changes: 0 additions & 15 deletions crates/biome_css_formatter/src/css/any/keyframe_name.rs

This file was deleted.

15 changes: 15 additions & 0 deletions crates/biome_css_formatter/src/css/any/keyframes_identifier.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! This is a generated file. Don't modify it by hand! Run 'cargo codegen formatter' to re-generate the file.

use crate::prelude::*;
use biome_css_syntax::AnyCssKeyframesIdentifier;
#[derive(Debug, Clone, Default)]
pub(crate) struct FormatAnyCssKeyframesIdentifier;
impl FormatRule<AnyCssKeyframesIdentifier> for FormatAnyCssKeyframesIdentifier {
type Context = CssFormatContext;
fn fmt(&self, node: &AnyCssKeyframesIdentifier, f: &mut CssFormatter) -> FormatResult<()> {
match node {
AnyCssKeyframesIdentifier::CssCustomIdentifier(node) => node.format().fmt(f),
AnyCssKeyframesIdentifier::CssString(node) => node.format().fmt(f),
}
}
}
16 changes: 16 additions & 0 deletions crates/biome_css_formatter/src/css/any/keyframes_name.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! This is a generated file. Don't modify it by hand! Run 'cargo codegen formatter' to re-generate the file.

use crate::prelude::*;
use biome_css_syntax::AnyCssKeyframesName;
#[derive(Debug, Clone, Default)]
pub(crate) struct FormatAnyCssKeyframesName;
impl FormatRule<AnyCssKeyframesName> for FormatAnyCssKeyframesName {
type Context = CssFormatContext;
fn fmt(&self, node: &AnyCssKeyframesName, f: &mut CssFormatter) -> FormatResult<()> {
match node {
AnyCssKeyframesName::AnyCssKeyframesIdentifier(node) => node.format().fmt(f),
AnyCssKeyframesName::CssBogusKeyframesName(node) => node.format().fmt(f),
AnyCssKeyframesName::CssKeyframesScopedName(node) => node.format().fmt(f),
}
}
}
15 changes: 15 additions & 0 deletions crates/biome_css_formatter/src/css/any/keyframes_scope.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! This is a generated file. Don't modify it by hand! Run 'cargo codegen formatter' to re-generate the file.

use crate::prelude::*;
use biome_css_syntax::AnyCssKeyframesScope;
#[derive(Debug, Clone, Default)]
pub(crate) struct FormatAnyCssKeyframesScope;
impl FormatRule<AnyCssKeyframesScope> for FormatAnyCssKeyframesScope {
type Context = CssFormatContext;
fn fmt(&self, node: &AnyCssKeyframesScope, f: &mut CssFormatter) -> FormatResult<()> {
match node {
AnyCssKeyframesScope::CssKeyframesScopeFunction(node) => node.format().fmt(f),
AnyCssKeyframesScope::CssKeyframesScopePrefix(node) => node.format().fmt(f),
}
}
}
4 changes: 3 additions & 1 deletion crates/biome_css_formatter/src/css/any/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ pub(crate) mod generic_component_value;
pub(crate) mod import_layer;
pub(crate) mod import_supports_condition;
pub(crate) mod import_url;
pub(crate) mod keyframe_name;
pub(crate) mod keyframes_block;
pub(crate) mod keyframes_identifier;
pub(crate) mod keyframes_item;
pub(crate) mod keyframes_name;
pub(crate) mod keyframes_scope;
pub(crate) mod keyframes_selector;
pub(crate) mod layer;
pub(crate) mod media_and_combinable_condition;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use crate::prelude::*;
use biome_css_syntax::{CssKeyframesScopeFunction, CssKeyframesScopeFunctionFields};
use biome_formatter::write;

#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssKeyframesScopeFunction;
impl FormatNodeRule<CssKeyframesScopeFunction> for FormatCssKeyframesScopeFunction {
fn fmt_fields(
&self,
node: &CssKeyframesScopeFunction,
f: &mut CssFormatter,
) -> FormatResult<()> {
let CssKeyframesScopeFunctionFields {
scope,
l_paren_token,
name,
r_paren_token,
} = node.as_fields();

write!(
f,
[
scope.format(),
l_paren_token.format(),
name.format(),
r_paren_token.format(),
]
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use crate::prelude::*;
use biome_css_syntax::{CssKeyframesScopePrefix, CssKeyframesScopePrefixFields};
use biome_formatter::write;

#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssKeyframesScopePrefix;
impl FormatNodeRule<CssKeyframesScopePrefix> for FormatCssKeyframesScopePrefix {
fn fmt_fields(&self, node: &CssKeyframesScopePrefix, f: &mut CssFormatter) -> FormatResult<()> {
let CssKeyframesScopePrefixFields { scope, name } = node.as_fields();

write!(f, [scope.format(), space(), name.format(),])
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use crate::prelude::*;
use biome_css_syntax::{CssKeyframesScopedName, CssKeyframesScopedNameFields};
use biome_formatter::write;

#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssKeyframesScopedName;
impl FormatNodeRule<CssKeyframesScopedName> for FormatCssKeyframesScopedName {
fn fmt_fields(&self, node: &CssKeyframesScopedName, f: &mut CssFormatter) -> FormatResult<()> {
let CssKeyframesScopedNameFields { colon_token, scope } = node.as_fields();

write!(f, [colon_token.format(), scope.format(),])
}
}
3 changes: 3 additions & 0 deletions crates/biome_css_formatter/src/css/auxiliary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ pub(crate) mod import_named_layer;
pub(crate) mod import_supports;
pub(crate) mod keyframes_block;
pub(crate) mod keyframes_item;
pub(crate) mod keyframes_scope_function;
pub(crate) mod keyframes_scope_prefix;
pub(crate) mod keyframes_scoped_name;
pub(crate) mod layer_declaration;
pub(crate) mod layer_reference;
pub(crate) mod list_of_component_values_expression;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use crate::FormatBogusNodeRule;
use biome_css_syntax::CssBogusKeyframesName;
#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssBogusKeyframesName;
impl FormatBogusNodeRule<CssBogusKeyframesName> for FormatCssBogusKeyframesName {}
1 change: 1 addition & 0 deletions crates/biome_css_formatter/src/css/bogus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub(crate) mod bogus_document_matcher;
pub(crate) mod bogus_font_family_name;
pub(crate) mod bogus_font_feature_values_item;
pub(crate) mod bogus_keyframes_item;
pub(crate) mod bogus_keyframes_name;
pub(crate) mod bogus_layer;
pub(crate) mod bogus_media_query;
pub(crate) mod bogus_page_selector_pseudo;
Expand Down
21 changes: 18 additions & 3 deletions crates/biome_css_formatter/src/css/statements/value_at_rule.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
use crate::prelude::*;
use biome_css_syntax::CssValueAtRule;
use biome_rowan::AstNode;
use biome_css_syntax::{CssValueAtRule, CssValueAtRuleFields};
use biome_formatter::write;

#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssValueAtRule;
impl FormatNodeRule<CssValueAtRule> for FormatCssValueAtRule {
fn fmt_fields(&self, node: &CssValueAtRule, f: &mut CssFormatter) -> FormatResult<()> {
format_verbatim_node(node.syntax()).fmt(f)
let CssValueAtRuleFields {
value_token,
clause,
semicolon_token,
} = node.as_fields();

write!(
f,
[
value_token.format(),
space(),
clause.format(),
semicolon_token.format(),
]
)
}
}
Loading

0 comments on commit 1fbc42e

Please sign in to comment.