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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn is_root_in_view_transition_pseudo_element(type_selector: &CssTypeSelector) ->
let Some(type_selector_text) = type_selector
.ident()
.ok()
.and_then(|ident| ident.value_token().ok())
.and_then(|ident| ident.as_css_identifier().and_then(|ident| ident.value_token().ok()))
.map(|token| token.token_text_trimmed().text().to_string())
else {
return false;
Expand Down Expand Up @@ -113,6 +113,7 @@ impl Rule for NoUnknownTypeSelector {
let type_selector = css_type_selector
.ident()
.ok()?
.as_css_identifier()?
.value_token()
.ok()?
.token_text_trimmed();
Expand Down
36 changes: 31 additions & 5 deletions 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.

32 changes: 28 additions & 4 deletions 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.

2 changes: 2 additions & 0 deletions crates/biome_css_formatter/src/css/any/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ pub(crate) mod rule;
pub(crate) mod rule_block;
pub(crate) mod scope_range;
pub(crate) mod selector;
pub(crate) mod selector_custom_identifier;
pub(crate) mod selector_identifier;
pub(crate) mod simple_selector;
pub(crate) mod sub_selector;
pub(crate) mod supports_and_combinable_condition;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//! 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::AnyCssSelectorCustomIdentifier;
#[derive(Debug, Clone, Default)]
pub(crate) struct FormatAnyCssSelectorCustomIdentifier;
impl FormatRule<AnyCssSelectorCustomIdentifier> for FormatAnyCssSelectorCustomIdentifier {
type Context = CssFormatContext;
fn fmt(&self, node: &AnyCssSelectorCustomIdentifier, f: &mut CssFormatter) -> FormatResult<()> {
match node {
AnyCssSelectorCustomIdentifier::CssCustomIdentifier(node) => node.format().fmt(f),
AnyCssSelectorCustomIdentifier::ScssInterpolatedIdentifier(node) => {
node.format().fmt(f)
}
}
}
}
15 changes: 15 additions & 0 deletions crates/biome_css_formatter/src/css/any/selector_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::AnyCssSelectorIdentifier;
#[derive(Debug, Clone, Default)]
pub(crate) struct FormatAnyCssSelectorIdentifier;
impl FormatRule<AnyCssSelectorIdentifier> for FormatAnyCssSelectorIdentifier {
type Context = CssFormatContext;
fn fmt(&self, node: &AnyCssSelectorIdentifier, f: &mut CssFormatter) -> FormatResult<()> {
match node {
AnyCssSelectorIdentifier::CssIdentifier(node) => node.format().fmt(f),
AnyCssSelectorIdentifier::ScssInterpolatedIdentifier(node) => node.format().fmt(f),
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ impl FormatRule<CssRelativeSelectorList> for FormatCssRelativeSelectorList {
})
.and_then(|computed_selector| computed_selector.simple_selector())
.and_then(|simple_selector| simple_selector.as_css_type_selector().cloned())
.and_then(|type_selector| type_selector.ident().ok()?.value_token().ok())
.and_then(|type_selector| {
type_selector
.ident()
.ok()?
.as_css_identifier()
.and_then(|ident| ident.value_token().ok())
})
.is_some_and(|value_token| value_token.has_leading_comments());

if has_leading_comments {
Expand Down
8 changes: 7 additions & 1 deletion crates/biome_css_formatter/src/css/lists/selector_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ impl FormatRule<CssSelectorList> for FormatCssSelectorList {
let simple_selector_has_leading_comments = computed_selector
.simple_selector()
.and_then(|simple_selector| simple_selector.as_css_type_selector().cloned())
.and_then(|type_selector| type_selector.ident().ok()?.value_token().ok())
.and_then(|type_selector| {
type_selector
.ident()
.ok()?
.as_css_identifier()
.and_then(|ident| ident.value_token().ok())
})
.is_some_and(|value_token| value_token.has_leading_comments());

// Sub selector same as the Simple Selector above:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ impl FormatNodeRule<CssComplexSelector> for FormatCssComplexSelector {
let simple_selector_has_leading_comments = computed_selector
.simple_selector()
.and_then(|simple_selector| simple_selector.as_css_type_selector().cloned())
.and_then(|type_selector| type_selector.ident().ok()?.value_token().ok())
.and_then(|type_selector| {
type_selector
.ident()
.ok()?
.as_css_identifier()
.and_then(|ident| ident.value_token().ok())
})
.is_some_and(|value_token| value_token.has_leading_comments());

let sub_selector_has_leading_comments = computed_selector
Expand Down
Loading
Loading