forked from biomejs/biome
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(css_parser): fix CSS: Layout using named grid lines biomejs#3055 (b…
- Loading branch information
1 parent
aa2b52f
commit 2a4d372
Showing
29 changed files
with
1,257 additions
and
412 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
24 changes: 24 additions & 0 deletions
24
crates/biome_css_formatter/src/css/auxiliary/bracketed_value.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,24 @@ | ||
use crate::prelude::*; | ||
use biome_css_syntax::{CssBracketedValue, CssBracketedValueFields}; | ||
use biome_formatter::write; | ||
|
||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatCssBracketedValue; | ||
impl FormatNodeRule<CssBracketedValue> for FormatCssBracketedValue { | ||
fn fmt_fields(&self, node: &CssBracketedValue, f: &mut CssFormatter) -> FormatResult<()> { | ||
let CssBracketedValueFields { | ||
l_brack_token, | ||
items, | ||
r_brack_token, | ||
} = node.as_fields(); | ||
|
||
write!( | ||
f, | ||
[ | ||
l_brack_token.format(), | ||
soft_block_indent(&items.format()), | ||
r_brack_token.format() | ||
] | ||
) | ||
} | ||
} |
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
12 changes: 12 additions & 0 deletions
12
crates/biome_css_formatter/src/css/lists/bracketed_value_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,12 @@ | ||
use crate::prelude::*; | ||
use biome_css_syntax::CssBracketedValueList; | ||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatCssBracketedValueList; | ||
impl FormatRule<CssBracketedValueList> for FormatCssBracketedValueList { | ||
type Context = CssFormatContext; | ||
fn fmt(&self, node: &CssBracketedValueList, f: &mut CssFormatter) -> FormatResult<()> { | ||
f.join_with(&space()) | ||
.entries(node.iter().formatted()) | ||
.finish() | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
crates/biome_css_formatter/tests/specs/css/properties/grid.css
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,11 @@ | ||
.chat-image { | ||
grid-row: span 2 / span 2; | ||
align-self: flex-end | ||
} | ||
|
||
|
||
#grid { | ||
display: grid; | ||
grid-template-columns: [first nav-start] 150px [main-start] 1fr [last]; | ||
grid-template-rows: [first header-start] 50px [main-start] 1fr [footer-start] 50px [last]; | ||
} |
49 changes: 49 additions & 0 deletions
49
crates/biome_css_formatter/tests/specs/css/properties/grid.css.snap
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,49 @@ | ||
--- | ||
source: crates/biome_formatter_test/src/snapshot_builder.rs | ||
info: css/properties/grid.css | ||
--- | ||
# Input | ||
|
||
```css | ||
.chat-image { | ||
grid-row: span 2 / span 2; | ||
align-self: flex-end | ||
} | ||
|
||
|
||
#grid { | ||
display: grid; | ||
grid-template-columns: [first nav-start] 150px [main-start] 1fr [last]; | ||
grid-template-rows: [first header-start] 50px [main-start] 1fr [footer-start] 50px [last]; | ||
} | ||
|
||
``` | ||
|
||
|
||
============================= | ||
|
||
# Outputs | ||
|
||
## Output 1 | ||
|
||
----- | ||
Indent style: Tab | ||
Indent width: 2 | ||
Line ending: LF | ||
Line width: 80 | ||
Quote style: Double Quotes | ||
----- | ||
|
||
```css | ||
.chat-image { | ||
grid-row: span 2 / span 2; | ||
align-self: flex-end; | ||
} | ||
|
||
#grid { | ||
display: grid; | ||
grid-template-columns: [first nav-start] 150px [main-start] 1fr [last]; | ||
grid-template-rows: [first header-start] 50px [main-start] 1fr [footer-start] | ||
50px [last]; | ||
} | ||
``` |
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
Oops, something went wrong.