Skip to content

Commit ed51ba7

Browse files
committed
Update syntax definitions
1 parent d256d53 commit ed51ba7

File tree

7 files changed

+500
-79
lines changed

7 files changed

+500
-79
lines changed

packages/vscode-tailwindcss/package.json

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,50 @@
5252
],
5353
"grammars": [
5454
{
55-
"scopeName": "tailwindcss.injection",
56-
"path": "./syntaxes/tailwind.tmLanguage.json",
55+
"scopeName": "tailwindcss.at-rules.injection",
56+
"path": "./syntaxes/at-rules.tmLanguage.json",
57+
"injectTo": [
58+
"source.css",
59+
"source.css.postcss",
60+
"source.vue",
61+
"source.svelte",
62+
"text.html"
63+
]
64+
},
65+
{
66+
"scopeName": "tailwindcss.at-rules.scss.injection",
67+
"path": "./syntaxes/at-rules.scss.tmLanguage.json",
68+
"injectTo": [
69+
"source.css.scss"
70+
]
71+
},
72+
{
73+
"scopeName": "tailwindcss.at-apply.injection",
74+
"path": "./syntaxes/at-apply.tmLanguage.json",
75+
"injectTo": [
76+
"source.css",
77+
"source.css.postcss",
78+
"source.vue",
79+
"source.svelte",
80+
"text.html"
81+
]
82+
},
83+
{
84+
"scopeName": "tailwindcss.theme-fn.injection",
85+
"path": "./syntaxes/theme-fn.tmLanguage.json",
86+
"injectTo": [
87+
"source.css",
88+
"source.css.postcss",
89+
"source.vue",
90+
"source.svelte",
91+
"text.html"
92+
]
93+
},
94+
{
95+
"scopeName": "tailwindcss.screen-fn.injection",
96+
"path": "./syntaxes/screen-fn.tmLanguage.json",
5797
"injectTo": [
5898
"source.css",
59-
"source.css.scss",
60-
"source.css.less",
6199
"source.css.postcss",
62100
"source.vue",
63101
"source.svelte",
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"scopeName": "tailwindcss.at-apply.injection",
3+
"fileTypes": [],
4+
"injectionSelector": "L:meta.property-list.css -comment, meta.property-list.scss -comment",
5+
"name": "TailwindCSS",
6+
"patterns": [
7+
{
8+
"name": "meta.at-rule.apply.tailwind",
9+
"begin": "(@)apply\\b",
10+
"beginCaptures": {
11+
"0": {
12+
"name": "keyword.control.at-rule.apply.tailwind"
13+
},
14+
"1": {
15+
"name": "punctuation.definition.keyword.css"
16+
}
17+
},
18+
"end": ";|(?=[}])",
19+
"endCaptures": {
20+
"0": {
21+
"name": "punctuation.terminator.apply.tailwind"
22+
}
23+
},
24+
"patterns": [
25+
{
26+
"include": "source.css#comment-block"
27+
},
28+
{
29+
"match": "!\\s*important(?![\\w-])",
30+
"name": "keyword.other.important.css"
31+
},
32+
{
33+
"match": "[^\\s;]+?",
34+
"name": "entity.other.attribute-name.class.css"
35+
}
36+
]
37+
}
38+
]
39+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{
2+
"scopeName": "tailwindcss.at-rules.scss.injection",
3+
"fileTypes": [],
4+
"injectionSelector": "L:source.css.scss -comment",
5+
"name": "TailwindCSS",
6+
"patterns": [
7+
{
8+
"begin": "(?i)((@)tailwind)(?=\\s|/\\*|$)",
9+
"beginCaptures": {
10+
"1": {
11+
"name": "keyword.control.at-rule.tailwind.tailwind"
12+
},
13+
"2": {
14+
"name": "punctuation.definition.keyword.css"
15+
}
16+
},
17+
"end": ";",
18+
"endCaptures": {
19+
"0": {
20+
"name": "punctuation.terminator.tailwind.tailwind"
21+
}
22+
},
23+
"name": "meta.at-rule.tailwind.css",
24+
"patterns": [
25+
{
26+
"include": "source.css#comment-block"
27+
},
28+
{
29+
"include": "source.css#escapes"
30+
},
31+
{
32+
"match": "[^\\s;]+?",
33+
"name": "entity.name.function.scss"
34+
}
35+
]
36+
},
37+
{
38+
"begin": "(?i)((@)screen)\\b",
39+
"beginCaptures": {
40+
"1": {
41+
"name": "keyword.control.at-rule.screen.tailwind"
42+
},
43+
"2": {
44+
"name": "punctuation.definition.keyword.css"
45+
}
46+
},
47+
"end": "\\s*(?={)",
48+
"patterns": [
49+
{
50+
"include": "source.css#comment-block"
51+
},
52+
{
53+
"match": "[^\\s{]+?",
54+
"name": "entity.name.function.scss"
55+
}
56+
]
57+
},
58+
{
59+
"begin": "(?i)((@)layer)\\b",
60+
"beginCaptures": {
61+
"1": {
62+
"name": "keyword.control.at-rule.layer.tailwind"
63+
},
64+
"2": {
65+
"name": "punctuation.definition.keyword.css"
66+
}
67+
},
68+
"end": "\\s*(?={)",
69+
"patterns": [
70+
{
71+
"include": "source.css#comment-block"
72+
},
73+
{
74+
"match": "[^\\s{]+?",
75+
"name": "entity.name.function.scss"
76+
}
77+
]
78+
},
79+
{
80+
"begin": "(?i)((@)variants)\\b",
81+
"beginCaptures": {
82+
"1": {
83+
"name": "keyword.control.at-rule.variants.tailwind"
84+
},
85+
"2": {
86+
"name": "punctuation.definition.keyword.css"
87+
}
88+
},
89+
"end": "\\s*(?={)",
90+
"patterns": [
91+
{
92+
"include": "source.css#comment-block"
93+
},
94+
{
95+
"include": "source.css#commas"
96+
},
97+
{
98+
"match": "[^\\s{,]+?",
99+
"name": "entity.name.function.scss"
100+
}
101+
]
102+
},
103+
{
104+
"begin": "(?i)((@)responsive)\\b",
105+
"beginCaptures": {
106+
"1": {
107+
"name": "keyword.control.at-rule.responsive.tailwind"
108+
},
109+
"2": {
110+
"name": "punctuation.definition.keyword.css"
111+
}
112+
},
113+
"end": "\\s*(?={)",
114+
"patterns": [
115+
{
116+
"include": "source.css#comment-block"
117+
}
118+
]
119+
}
120+
]
121+
}

0 commit comments

Comments
 (0)