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
12 changes: 12 additions & 0 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.

26 changes: 26 additions & 0 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.

1 change: 1 addition & 0 deletions crates/biome_css_formatter/src/css/any/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ impl FormatRule<AnyCssExpression> for FormatAnyCssExpression {
AnyCssExpression::CssCommaSeparatedValue(node) => node.format().fmt(f),
AnyCssExpression::CssListOfComponentValuesExpression(node) => node.format().fmt(f),
AnyCssExpression::CssParenthesizedExpression(node) => node.format().fmt(f),
AnyCssExpression::CssUnaryExpression(node) => node.format().fmt(f),
}
}
}
1 change: 1 addition & 0 deletions crates/biome_css_formatter/src/css/auxiliary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pub(crate) mod syntax_component_without_multiplier;
pub(crate) mod syntax_multiplier;
pub(crate) mod syntax_type;
pub(crate) mod type_function;
pub(crate) mod unary_expression;
pub(crate) mod unicode_codepoint;
pub(crate) mod unicode_range;
pub(crate) mod unicode_range_interval;
Expand Down
18 changes: 18 additions & 0 deletions crates/biome_css_formatter/src/css/auxiliary/unary_expression.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use crate::prelude::*;
use biome_css_syntax::{CssUnaryExpression, CssUnaryExpressionFields};
use biome_formatter::write;

#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssUnaryExpression;
impl FormatNodeRule<CssUnaryExpression> for FormatCssUnaryExpression {
fn fmt_fields(&self, node: &CssUnaryExpression, f: &mut CssFormatter) -> FormatResult<()> {
let CssUnaryExpressionFields {
operator,
expression,
} = node.as_fields();
let operator = operator?;
let expression = expression?;

write!(f, [operator.format(), expression.format()])
}
}
38 changes: 38 additions & 0 deletions crates/biome_css_formatter/src/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6225,6 +6225,44 @@ impl IntoFormat<CssFormatContext> for biome_css_syntax::CssTypeSelector {
)
}
}
impl FormatRule<biome_css_syntax::CssUnaryExpression>
for crate::css::auxiliary::unary_expression::FormatCssUnaryExpression
{
type Context = CssFormatContext;
#[inline(always)]
fn fmt(
&self,
node: &biome_css_syntax::CssUnaryExpression,
f: &mut CssFormatter,
) -> FormatResult<()> {
FormatNodeRule::<biome_css_syntax::CssUnaryExpression>::fmt(self, node, f)
}
}
impl AsFormat<CssFormatContext> for biome_css_syntax::CssUnaryExpression {
type Format<'a> = FormatRefWithRule<
'a,
biome_css_syntax::CssUnaryExpression,
crate::css::auxiliary::unary_expression::FormatCssUnaryExpression,
>;
fn format(&self) -> Self::Format<'_> {
FormatRefWithRule::new(
self,
crate::css::auxiliary::unary_expression::FormatCssUnaryExpression::default(),
)
}
}
impl IntoFormat<CssFormatContext> for biome_css_syntax::CssUnaryExpression {
type Format = FormatOwnedWithRule<
biome_css_syntax::CssUnaryExpression,
crate::css::auxiliary::unary_expression::FormatCssUnaryExpression,
>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(
self,
crate::css::auxiliary::unary_expression::FormatCssUnaryExpression::default(),
)
}
}
impl FormatRule<biome_css_syntax::CssUnicodeCodepoint>
for crate::css::auxiliary::unicode_codepoint::FormatCssUnicodeCodepoint
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
source: crates/biome_formatter_test/src/snapshot_builder.rs
assertion_line: 212
info: css/scss/expression/qualified-names.scss
---

# Input

```scss
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.unary-precedence{
width:calc(-1 +2);
width:calc(+var(--x)+1px);
width:calc(- var(--y)*2);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
source: crates/biome_formatter_test/src/snapshot_builder.rs
assertion_line: 212
info: css/unary-precedence.css
---

# Input

```css
.unary-precedence{
width:calc(-1 +2);
width:calc(+var(--x)+1px);
width:calc(- var(--y)*2);
}

```


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

# Outputs

## Output 1

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

```css
.unary-precedence {
width: calc(-1 +2);
width: calc(+var(--x) +1px);
width: calc(-var(--y) * 2);
}

```
Loading