Skip to content

Commit 93bffe9

Browse files
author
DeathAxe
committed
[CSS] Stricter functional pseudo-class patterns
Only add meta.function-call scope if a pseudo-class looks like that.
1 parent 90adccf commit 93bffe9

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

CSS/CSS.sublime-syntax

+4-4
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ contexts:
11341134
# Special :dir() pseudo-class
11351135
# https://drafts.csswg.org/selectors-4/#the-dir-pseudo
11361136
pseudo-class-function-dir:
1137-
- match: (?i:dir){{break}}
1137+
- match: (?i:dir)(?=\()
11381138
scope: meta.function-call.identifier.css entity.other.pseudo-class.css
11391139
set:
11401140
- meta_include_prototype: false
@@ -1150,7 +1150,7 @@ contexts:
11501150
# Special :lang() pseudo-class
11511151
# https://drafts.csswg.org/selectors-4/#the-lang-pseudo
11521152
pseudo-class-function-lang:
1153-
- match: (?i:lang){{break}}
1153+
- match: (?i:lang)(?=\()
11541154
scope: meta.function-call.identifier.css entity.other.pseudo-class.css
11551155
set:
11561156
- meta_include_prototype: false
@@ -1177,7 +1177,7 @@ contexts:
11771177
| nth-child
11781178
| nth-last-of-type
11791179
| nth-of-type
1180-
){{break}}
1180+
)(?=\()
11811181
scope: meta.function-call.identifier.css entity.other.pseudo-class.css
11821182
set:
11831183
- meta_include_prototype: false
@@ -1207,7 +1207,7 @@ contexts:
12071207

12081208
# Functional Pseudo Classes with selector list
12091209
pseudo-class-function-with-selector-args:
1210-
- match: (?i:matches|not|has){{break}}
1210+
- match: (?i:matches|not|has)(?=\()
12111211
scope: meta.function-call.identifier.css entity.other.pseudo-class.css
12121212
set:
12131213
- meta_include_prototype: false

CSS/syntax_test_css.css

+6
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,13 @@
13951395
/* ^^^^^^^^^^^ entity.other.pseudo-class.css */
13961396
/* ^^^ support.constant.property-value.css */
13971397

1398+
.test-pseudo-class-strings:dir {}
1399+
/* ^ punctuation.accessor.colon.css - entity */
1400+
/* ^^^ entity.other.pseudo-class.css - meta.function-call */
1401+
13981402
.test-pseudo-class-strings:dir(ltr) {}
1403+
/* ^^^ meta.function-call.identifier.css */
1404+
/* ^^^^^ meta.function-call.arguments.css meta.group.css */
13991405
/* ^ punctuation.accessor.colon.css - entity */
14001406
/* ^^^ entity.other.pseudo-class.css */
14011407
/* ^^^ support.constant.property-value.css */

0 commit comments

Comments
 (0)