-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CSS extras: Highlighting for pseudo class arguments (#1650)
This adds highlighting for pseudo class arguments, selector punctuation, and n-th expressions.
- Loading branch information
1 parent
18f2921
commit 70a4041
Showing
5 changed files
with
136 additions
and
13 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.
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
62 changes: 62 additions & 0 deletions
62
tests/languages/css!+css-extras/selector_n-th_feature.test
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,62 @@ | ||
:nth-child(2n+1) {} | ||
:nth-child(+2n - 1) {} | ||
:nth-child(2n) {} | ||
:nth-child(+5) {} | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["selector", [ | ||
["pseudo-class", ":nth-child"], | ||
["punctuation", "("], | ||
["n-th", [ | ||
["number", "2n"], | ||
["operator", "+"], | ||
["number", "1"] | ||
]], | ||
["punctuation", ")"] | ||
]], | ||
["punctuation", "{"], | ||
["punctuation", "}"], | ||
|
||
["selector", [ | ||
["pseudo-class", ":nth-child"], | ||
["punctuation", "("], | ||
["n-th", [ | ||
["operator", "+"], | ||
["number", "2n"], | ||
["operator", "-"], | ||
["number", "1"] | ||
]], | ||
["punctuation", ")"] | ||
]], | ||
["punctuation", "{"], | ||
["punctuation", "}"], | ||
|
||
["selector", [ | ||
["pseudo-class", ":nth-child"], | ||
["punctuation", "("], | ||
["n-th", [ | ||
["number", "2n"] | ||
]], | ||
["punctuation", ")"] | ||
]], | ||
["punctuation", "{"], | ||
["punctuation", "}"], | ||
|
||
["selector", [ | ||
["pseudo-class", ":nth-child"], | ||
["punctuation", "("], | ||
["n-th", [ | ||
["operator", "+"], | ||
["number", "5"] | ||
]], | ||
["punctuation", ")"] | ||
]], | ||
["punctuation", "{"], | ||
["punctuation", "}"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for n-th expressions. |
59 changes: 59 additions & 0 deletions
59
tests/languages/css!+css-extras/selector_pseudo-class_feature.test
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,59 @@ | ||
foo:hover {} | ||
|
||
:lang(en) {} | ||
|
||
.bar:not(baz:hover):not(.foo) {} | ||
|
||
:where(p:not(.class)) {} | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["selector", [ | ||
"foo", | ||
["pseudo-class", ":hover"] | ||
]], | ||
["punctuation", "{"], | ||
["punctuation", "}"], | ||
|
||
["selector", [ | ||
["pseudo-class", ":lang"], | ||
["punctuation", "("], | ||
"en", | ||
["punctuation", ")"] | ||
]], | ||
["punctuation", "{"], | ||
["punctuation", "}"], | ||
|
||
["selector", [ | ||
["class", ".bar"], | ||
["pseudo-class", ":not"], | ||
["punctuation", "("], | ||
"baz", | ||
["pseudo-class", ":hover"], | ||
["punctuation", ")"], | ||
["pseudo-class", ":not"], | ||
["punctuation", "("], | ||
["class", ".foo"], | ||
["punctuation", ")"] | ||
]], | ||
["punctuation", "{"], | ||
["punctuation", "}"], | ||
|
||
["selector", [ | ||
["pseudo-class", ":where"], | ||
["punctuation", "("], | ||
"p", | ||
["pseudo-class", ":not"], | ||
["punctuation", "("], | ||
["class", ".class"], | ||
["punctuation", ")"], | ||
["punctuation", ")"] | ||
]], | ||
["punctuation", "{"], | ||
["punctuation", "}"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for pseudo-classes inside selectors. |