Skip to content

Commit 37259b0

Browse files
Alexander Chenangelozerr
authored andcommitted
Added section tag core pattern for improved Qute syntax grouping
Signed-off-by: Alexander Chen <alchen@redhat.com>
1 parent 9c299f2 commit 37259b0

File tree

1 file changed

+59
-21
lines changed

1 file changed

+59
-21
lines changed

language-support/qute/qute.tmLanguage.json

Lines changed: 59 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@
2121
"templates": {
2222
"patterns": [
2323
{
24-
"include": "#section_start_tag"
24+
"include": "#section_start_default_tag"
2525
},
2626
{
27-
"include": "#section_end_tag"
27+
"include": "#section_end_default_tag"
28+
},
29+
{
30+
"include": "#section_start_user_tag"
31+
},
32+
{
33+
"include": "#section_end_user_tag"
2834
},
2935
{
3036
"include": "#double_bracket"
@@ -79,8 +85,8 @@
7985
},
8086
"name": "string.unquoted.cdata.qute"
8187
},
82-
"section_start_tag": {
83-
"begin": "({)(#)(else\\sif|\\w+(\\.\\w+)*)",
88+
"section_start_default_tag": {
89+
"begin": "({)(#)((each|else|else\\sif|eval|for|if|include|insert|set|let|with|switch|case|is|when)\\b)",
8490
"end": "(\\/)?((?<![\\\\])})",
8591
"beginCaptures": {
8692
"1": {
@@ -107,8 +113,8 @@
107113
}
108114
]
109115
},
110-
"section_end_tag": {
111-
"begin": "({)(\\/)(\\w+(\\.\\w+)*)?\\s*",
116+
"section_end_default_tag": {
117+
"begin": "({)(\\/)((each|else|else\\sif|eval|for|if|include|insert|set|let|with|switch|case|is|when)\\b)",
112118
"end": "((?<![\\\\])})",
113119
"beginCaptures": {
114120
"1": {
@@ -127,9 +133,53 @@
127133
}
128134
}
129135
},
130-
"section_start_tag_content": {
131-
"match": "((\\s+[^}\\/]+)*)\\s*",
132-
"name": "variable.parameter.function.qute"
136+
"section_start_user_tag": {
137+
"begin": "({)(#)(\\w+(\\.\\w+)*)",
138+
"end": "(\\/)?((?<![\\\\])})",
139+
"beginCaptures": {
140+
"1": {
141+
"name": "support.constant.handlebars"
142+
},
143+
"2": {
144+
"name": "entity.name.function.hash"
145+
},
146+
"3": {
147+
"name": "entity.name.function.identifier"
148+
}
149+
},
150+
"endCaptures": {
151+
"1": {
152+
"name": "keyword.control"
153+
},
154+
"2": {
155+
"name": "support.constant.handlebars"
156+
}
157+
},
158+
"patterns": [
159+
{
160+
"include": "#code"
161+
}
162+
]
163+
},
164+
"section_end_user_tag": {
165+
"begin": "({)(\\/)(\\w+(\\.\\w+)*)?\\s*",
166+
"end": "((?<![\\\\])})",
167+
"beginCaptures": {
168+
"1": {
169+
"name": "support.constant.handlebars"
170+
},
171+
"2": {
172+
"name": "entity.name.function.slash"
173+
},
174+
"3": {
175+
"name": "entity.name.function.identifier"
176+
}
177+
},
178+
"endCaptures": {
179+
"1": {
180+
"name": "support.constant.handlebars"
181+
}
182+
}
133183
},
134184
"double_bracket": {
135185
"match": "{{"
@@ -321,14 +371,6 @@
321371
"match": "\\?|:",
322372
"name": "keyword.control.ternary.java"
323373
},
324-
{
325-
"match": "\\b(return|break|case|continue|default|do|while|for|switch|if|else)\\b",
326-
"name": "keyword.control.java"
327-
},
328-
{
329-
"match": "\\b(instanceof)\\b",
330-
"name": "keyword.operator.instanceof.java"
331-
},
332374
{
333375
"match": "(<<|>>>?|~|\\^)",
334376
"name": "keyword.operator.bitwise.java"
@@ -365,10 +407,6 @@
365407
"match": "(\\||&)",
366408
"name": "keyword.operator.bitwise.java"
367409
},
368-
{
369-
"match": "\\b(const|goto)\\b",
370-
"name": "keyword.reserved.java"
371-
},
372410
{
373411
"match": "\\b(is|as|eq|ne|gt|ge|lt|le)\\b",
374412
"name": "keyword.control.operator"

0 commit comments

Comments
 (0)