Skip to content

Commit 187d8bd

Browse files
author
deathaxe
committed
Various compatibility fixes
Backport some changes from ST4174 to maintain compatibility with builds 4149..4180+.
1 parent 48dac19 commit 187d8bd

File tree

2 files changed

+49
-14
lines changed

2 files changed

+49
-14
lines changed

Tailwind CSS.sublime-syntax

+47-13
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,26 @@ file_extensions:
1111

1212
variables:
1313

14-
selector_start: '[[:alpha:]{{nested_selector_start}}]'
15-
nested_selector_begin: (?={{nested_selector_start}})
16-
nested_selector_start: '[.:#&*\[{{combinator_char}}]'
14+
# Properties and Selectors
15+
property_or_selector_begin: (?={{ident_begin}}|{{selector_start}})
16+
property_end: (?=[;@)}])
17+
18+
selector_start: '[[:alpha:].:#&*\[{{combinator_char}}]'
19+
selector_end: (?=[;@(){}])
1720

1821
contexts:
1922

23+
stylesheet:
24+
# relaxed properties vs. selectors
25+
- meta_include_prototype: false
26+
- include: comments
27+
- include: property-lists
28+
- include: properties-or-selectors
29+
- include: at-rules
30+
- include: rule-terminators
31+
- include: illegal-commas
32+
- include: illegal-groups
33+
2034
###[ CSS AT RULES ]############################################################
2135

2236
at-other:
@@ -29,38 +43,58 @@ contexts:
2943
- include: tailwind-at-screen
3044

3145
at-rule-block:
32-
# note: maintain compatibility with various ST4 builds
46+
# required until ST4174 (PR #3831)
3347
- match: \{
3448
scope: punctuation.section.block.begin.css
3549
push: at-rule-block-body
3650

3751
at-rule-block-body:
38-
# note: maintain compatibility with various ST4 builds
52+
# required until ST4174 (PR #3831)
3953
- meta_scope: meta.block.css
4054
- include: block-end2
4155
- include: stylesheet
4256

4357
###[ CSS SELECTORS ]###########################################################
4458

45-
nested-selectors:
46-
# https://drafts.csswg.org/css-nesting-1
47-
- match: '{{nested_selector_begin}}'
48-
push: selector-body
59+
properties-or-selectors:
60+
# required until ST4174 (PR #3898)
61+
- match: '{{property_or_selector_begin}}'
62+
branch_point: property-or-selector
63+
branch:
64+
- maybe-property
65+
- selector-body
66+
67+
maybe-property:
68+
# required until ST4174 (PR #3898)
69+
- meta_include_prototype: false
70+
- include: property-end
71+
- include: property-identifiers
72+
- match: ''
73+
fail: property-or-selector
74+
75+
property-end:
76+
# required until ST4174 (PR #3898)
77+
- match: '{{property_end}}'
78+
pop: 1
4979

5080
selector-variables:
81+
# required until ST4174 (PR #3898)
5182
- meta_prepend: true
5283
- match: \&
5384
scope: variable.language.parent.css
5485

5586
###[ CSS PROPERTY LISTS ]######################################################
5687

5788
property-list-body:
89+
# relaxed properties vs. selectors
5890
- meta_scope: meta.property-list.css meta.block.css
5991
- include: block-end
60-
- include: nested-selectors
61-
- include: at-rules
62-
- include: property-lists
63-
- include: rule-list-body
92+
- include: stylesheet
93+
94+
illegal-commas:
95+
# required until ST4174 (PR #3831)
96+
- match: ','
97+
scope: invalid.illegal.unexpected-token.css
6498

6599
###[ TAILWIND INLINE AT RULES ]################################################
66100

tests/syntax_test.tailwind.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -175,5 +175,6 @@
175175
/* ^ variable.language.parent.css */
176176
/* ^^^^^^^ entity.name.tag.html.css */
177177
article { ... }
178-
/* ^^^^^^^^ meta.property-list.css meta.block.css - meta.selector */
178+
/* ^^^^^^^ meta.property-list.css meta.block.css meta.selector.css entity.name.tag.html.css */
179+
/* ^ meta.property-list.css meta.block.css meta.selector.css - entity */
179180
}

0 commit comments

Comments
 (0)