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(css_parser): add :local and :global pseudo class. #3011 #3012

Merged
merged 6 commits into from
May 29, 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
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 = { path = "../biome_configuration" }
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
@@ -1,6 +1,7 @@
use crate::prelude::*;
use biome_css_syntax::CssValueAtRuleImportClause;
use biome_rowan::AstNode;
use biome_css_syntax::{CssValueAtRuleImportClause, CssValueAtRuleImportClauseFields};
use biome_formatter::write;

#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssValueAtRuleImportClause;
impl FormatNodeRule<CssValueAtRuleImportClause> for FormatCssValueAtRuleImportClause {
Expand All @@ -9,6 +10,21 @@ impl FormatNodeRule<CssValueAtRuleImportClause> for FormatCssValueAtRuleImportCl
node: &CssValueAtRuleImportClause,
f: &mut CssFormatter,
) -> FormatResult<()> {
format_verbatim_node(node.syntax()).fmt(f)
let CssValueAtRuleImportClauseFields {
specifiers,
from_token,
source,
} = node.as_fields();

write!(
f,
[
specifiers.format(),
space(),
from_token.format(),
space(),
source.format()
]
)
}
}
Loading
Loading