Skip to content

Commit

Permalink
[CSS] Add support for :is and :where pseudo class (#2798)
Browse files Browse the repository at this point in the history
* [CSS] Add support for `:is` pseudo class

* [CSS] Add support for `:where` pseudo class
  • Loading branch information
niksy committed Apr 29, 2021
1 parent 3e03b6f commit f74f184
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
10 changes: 5 additions & 5 deletions CSS/CSS.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ variables:
# matching (?!{{escape}}) which also effects performance negative.
break: (?=[[^-_[:alnum:]\\]&&[[:ascii:]]]|\Z)

# Identifiers
# Identifiers
# https://www.w3.org/TR/css-syntax-3/#typedef-ident-token
# https://www.w3.org/TR/css3-selectors/#lex
ident: (?:{{custom_ident}}|{{generic_ident}})
Expand Down Expand Up @@ -605,21 +605,21 @@ variables:
# https://www.w3.org/TR/CSS22/fonts.html#font-shorthand
font_property_constants: |-
\b(?xi:
caption | icon | menu | message-box | small-caption | status-bar
caption | icon | menu | message-box | small-caption | status-bar
){{break}}
# https://www.w3.org/TR/CSS22/fonts.html#font-size-props
font_size_constants: |-
\b(?xi:
larger | large | medium | small | smaller | x{1,2}-(?: large | small )
larger | large | medium | small | smaller | x{1,2}-(?: large | small )
){{break}}
# https://www.w3.org/TR/CSS22/fonts.html#font-boldness
# https://www.w3.org/TR/CSS22/fonts.html#font-styling
# https://www.w3.org/TR/CSS22/fonts.html#small-caps
font_style_constants: |-
\b(?xi:
normal | bold | bolder | lighter | italic | oblique | small-caps
normal | bold | bolder | lighter | italic | oblique | small-caps
){{break}}
###############################################################################
Expand Down Expand Up @@ -1308,7 +1308,7 @@ contexts:

# Functional Pseudo Classes with selector list
pseudo-class-function-with-selector-args:
- match: (?i:matches|not|has)(?=\()
- match: (?i:matches|is|where|not|has)(?=\()
scope: meta.function-call.identifier.css entity.other.pseudo-class.css
set:
- meta_include_prototype: false
Expand Down
14 changes: 12 additions & 2 deletions CSS/syntax_test_css.css
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@
}
/* <- meta.at-rule.counter-style.css meta.property-list.css meta.block.css punctuation.section.block.end.css */

.test-var-functions {
.test-var-functions {
--test-var: arial;
/* ^^^^^^^^^^ entity.other.custom-property.css */
/* ^ punctuation.separator.key-value.css*/
Expand Down Expand Up @@ -1600,6 +1600,16 @@
/* ^^^ entity.other.pseudo-class.css */
/* ^ variable.language.wildcard.asterisk.css */

.test-pseudo-class-tag:is(*) {}
/* ^ punctuation.definition.pseudo-class.css - entity */
/* ^^ entity.other.pseudo-class.css */
/* ^ variable.language.wildcard.asterisk.css */

.test-pseudo-class-tag:where(*) {}
/* ^ punctuation.definition.pseudo-class.css - entity */
/* ^^^^^ entity.other.pseudo-class.css */
/* ^ variable.language.wildcard.asterisk.css */

.test-pseudo-elements::before {}
/* ^^ punctuation.definition.pseudo-element.css - entity */
/* ^^^^^^ entity.other.pseudo-element.css */
Expand Down Expand Up @@ -2323,7 +2333,7 @@
/* ^^^^^ support.function.transform.css */
/* ^ meta.number.integer.decimal.css constant.numeric.value.css */
/* ^^^ meta.number.integer.decimal.css constant.numeric.suffix.css */

top: skew(1deg, 2turn);
/* ^^^^ support.function.transform.css */
/* ^ meta.number.integer.decimal.css constant.numeric.value.css */
Expand Down

0 comments on commit f74f184

Please sign in to comment.