-
-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(css_formatter): support meaningful boundaries for range formatti…
…ng (#1363)
- Loading branch information
1 parent
b99e785
commit c62a612
Showing
15 changed files
with
350 additions
and
2 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
15 changes: 15 additions & 0 deletions
15
crates/biome_css_formatter/tests/specs/css/range/between_rules.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,15 @@ | ||
|
||
div { color : blue ; | ||
|
||
<<<ROME_RANGE_START>>> | ||
background-color : | ||
green; | ||
} | ||
|
||
.foo html | ||
{ | ||
color : green ; | ||
<<<ROME_RANGE_END>>> | ||
|
||
background-color : blue; | ||
} |
56 changes: 56 additions & 0 deletions
56
crates/biome_css_formatter/tests/specs/css/range/between_rules.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,56 @@ | ||
--- | ||
source: crates/biome_formatter_test/src/snapshot_builder.rs | ||
info: css/range/between_rules.css | ||
--- | ||
|
||
# Input | ||
|
||
```css | ||
|
||
div { color : blue ; | ||
|
||
|
||
background-color : | ||
green; | ||
} | ||
|
||
.foo html | ||
{ | ||
color : green ; | ||
|
||
|
||
background-color : blue; | ||
} | ||
|
||
``` | ||
|
||
|
||
============================= | ||
|
||
# Outputs | ||
|
||
## Output 1 | ||
|
||
----- | ||
Indent style: Tab | ||
Indent width: 2 | ||
Line ending: LF | ||
Line width: 80 | ||
----- | ||
|
||
```css | ||
|
||
div { | ||
color: blue; | ||
|
||
background-color: green; | ||
} | ||
|
||
.foo html { | ||
color: green; | ||
|
||
background-color: blue; | ||
} | ||
``` | ||
|
||
|
10 changes: 10 additions & 0 deletions
10
crates/biome_css_formatter/tests/specs/css/range/keyframes.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,10 @@ | ||
@keyframes animation-name { | ||
10% <<<ROME_RANGE_START>>>, 20% { | ||
opacity: 0 | ||
; | ||
<<<ROME_RANGE_END>>> | ||
} | ||
|
||
100% { | ||
opacity : 1 } | ||
} |
47 changes: 47 additions & 0 deletions
47
crates/biome_css_formatter/tests/specs/css/range/keyframes.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,47 @@ | ||
--- | ||
source: crates/biome_formatter_test/src/snapshot_builder.rs | ||
info: css/range/keyframes.css | ||
--- | ||
|
||
# Input | ||
|
||
```css | ||
@keyframes animation-name { | ||
10% , 20% { | ||
opacity: 0 | ||
; | ||
|
||
} | ||
|
||
100% { | ||
opacity : 1 } | ||
} | ||
``` | ||
|
||
|
||
============================= | ||
|
||
# Outputs | ||
|
||
## Output 1 | ||
|
||
----- | ||
Indent style: Tab | ||
Indent width: 2 | ||
Line ending: LF | ||
Line width: 80 | ||
----- | ||
|
||
```css | ||
@keyframes animation-name { | ||
10%, | ||
20% { | ||
opacity: 0; | ||
} | ||
|
||
100% { | ||
opacity: 1; | ||
} | ||
}``` | ||
|
||
|
3 changes: 3 additions & 0 deletions
3
crates/biome_css_formatter/tests/specs/css/range/mid_value.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,3 @@ | ||
div { | ||
border : 1px <<<ROME_RANGE_START>>> solid green <<<ROME_RANGE_END>>>; | ||
} |
35 changes: 35 additions & 0 deletions
35
crates/biome_css_formatter/tests/specs/css/range/mid_value.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,35 @@ | ||
--- | ||
source: crates/biome_formatter_test/src/snapshot_builder.rs | ||
info: css/range/mid_value.css | ||
--- | ||
|
||
# Input | ||
|
||
```css | ||
div { | ||
border : 1px solid green ; | ||
} | ||
|
||
``` | ||
|
||
|
||
============================= | ||
|
||
# Outputs | ||
|
||
## Output 1 | ||
|
||
----- | ||
Indent style: Tab | ||
Indent width: 2 | ||
Line ending: LF | ||
Line width: 80 | ||
----- | ||
|
||
```css | ||
div { | ||
border: 1px solid green ; | ||
} | ||
``` | ||
|
||
|
1 change: 1 addition & 0 deletions
1
crates/biome_css_formatter/tests/specs/css/range/selector_list.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 @@ | ||
.foo , <<<ROME_RANGE_START>>> .bar:FIRST-CHILD <<<ROME_RANGE_END>>>, DIV {color: blue} |
33 changes: 33 additions & 0 deletions
33
crates/biome_css_formatter/tests/specs/css/range/selector_list.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,33 @@ | ||
--- | ||
source: crates/biome_formatter_test/src/snapshot_builder.rs | ||
info: css/range/selector_list.css | ||
--- | ||
|
||
# Input | ||
|
||
```css | ||
.foo , .bar:FIRST-CHILD , DIV {color: blue} | ||
``` | ||
|
||
|
||
============================= | ||
|
||
# Outputs | ||
|
||
## Output 1 | ||
|
||
----- | ||
Indent style: Tab | ||
Indent width: 2 | ||
Line ending: LF | ||
Line width: 80 | ||
----- | ||
|
||
```css | ||
.foo, | ||
.bar:first-child, | ||
div { | ||
color: blue; | ||
}``` | ||
|
||
|
6 changes: 6 additions & 0 deletions
6
crates/biome_css_formatter/tests/specs/css/range/single_declaration.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,6 @@ | ||
div{color : blue | ||
|
||
; | ||
<<<ROME_RANGE_START>>> border : 1px solid;<<<ROME_RANGE_END>>> | ||
} | ||
div{color:green;} |
40 changes: 40 additions & 0 deletions
40
crates/biome_css_formatter/tests/specs/css/range/single_declaration.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,40 @@ | ||
--- | ||
source: crates/biome_formatter_test/src/snapshot_builder.rs | ||
info: css/range/single_declaration.css | ||
--- | ||
|
||
# Input | ||
|
||
```css | ||
div{color : blue | ||
|
||
; | ||
border : 1px solid; | ||
} | ||
div{color:green;} | ||
|
||
``` | ||
|
||
|
||
============================= | ||
|
||
# Outputs | ||
|
||
## Output 1 | ||
|
||
----- | ||
Indent style: Tab | ||
Indent width: 2 | ||
Line ending: LF | ||
Line width: 80 | ||
----- | ||
|
||
```css | ||
div { | ||
color: blue; | ||
border: 1px solid; | ||
} | ||
div{color:green;} | ||
``` | ||
|
||
|
4 changes: 4 additions & 0 deletions
4
crates/biome_css_formatter/tests/specs/css/range/single_rule.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,4 @@ | ||
div{color:blue;} | ||
<<<ROME_RANGE_START>>>div{color:green;}<<<ROME_RANGE_END>>> | ||
|
||
div{color:red;} |
39 changes: 39 additions & 0 deletions
39
crates/biome_css_formatter/tests/specs/css/range/single_rule.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,39 @@ | ||
--- | ||
source: crates/biome_formatter_test/src/snapshot_builder.rs | ||
info: css/range/single_rule.css | ||
--- | ||
|
||
# Input | ||
|
||
```css | ||
div{color:blue;} | ||
div{color:green;} | ||
|
||
div{color:red;} | ||
|
||
``` | ||
|
||
|
||
============================= | ||
|
||
# Outputs | ||
|
||
## Output 1 | ||
|
||
----- | ||
Indent style: Tab | ||
Indent width: 2 | ||
Line ending: LF | ||
Line width: 80 | ||
----- | ||
|
||
```css | ||
div{color:blue;} | ||
div { | ||
color: green; | ||
} | ||
|
||
div{color:red;} | ||
``` | ||
|
||
|
5 changes: 5 additions & 0 deletions
5
crates/biome_css_formatter/tests/specs/css/range/single_value.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,5 @@ | ||
div { | ||
COLOR: GREEN; | ||
|
||
Border : 1px <<<ROME_RANGE_START>>>GrEeN<<<ROME_RANGE_END>>> solid ; | ||
} |
37 changes: 37 additions & 0 deletions
37
crates/biome_css_formatter/tests/specs/css/range/single_value.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,37 @@ | ||
--- | ||
source: crates/biome_formatter_test/src/snapshot_builder.rs | ||
info: css/range/single_value.css | ||
--- | ||
|
||
# Input | ||
|
||
```css | ||
div { | ||
COLOR: GREEN; | ||
|
||
Border : 1px GrEeN solid ; | ||
} | ||
``` | ||
|
||
|
||
============================= | ||
|
||
# Outputs | ||
|
||
## Output 1 | ||
|
||
----- | ||
Indent style: Tab | ||
Indent width: 2 | ||
Line ending: LF | ||
Line width: 80 | ||
----- | ||
|
||
```css | ||
div { | ||
COLOR: GREEN; | ||
|
||
Border : 1px green solid ; | ||
}``` | ||
|
||
|