Skip to content

Commit 4948f23

Browse files
authored
fix(angular): update grammars from upstream (#12)
1 parent bd2fd44 commit 4948f23

File tree

8 files changed

+254
-177
lines changed

8 files changed

+254
-177
lines changed

grammars/angular/syntaxes/expression.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
"name": "storage.type.as.ts"
139139
}
140140
},
141-
"end": "(?=$|\"|[;,:})\\]])",
141+
"end": "(?=$|\"|'|[;,:})\\]])",
142142
"patterns": [
143143
{
144144
"include": "#type"

grammars/angular/syntaxes/inline-styles.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@
8787
"name": "string"
8888
}
8989
},
90-
"contentName": "source.css",
90+
"contentName": "source.css.scss",
9191
"patterns": [
9292
{
93-
"include": "source.css"
93+
"include": "source.css.scss"
9494
}
9595
]
9696
}

grammars/angular/syntaxes/inline-template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"name": "string"
6363
}
6464
},
65-
"contentName": "text.html",
65+
"contentName": "text.html.derivative",
6666
"patterns": [
6767
{
6868
"include": "text.html.derivative"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"scopeName": "template.let.ng",
3+
"injectionSelector": "L:text.html -comment -expression.ng -meta.tag -source.css -source.js",
4+
"patterns": [
5+
{
6+
"include": "#letDeclaration"
7+
}
8+
],
9+
"repository": {
10+
"letDeclaration": {
11+
"begin": "(@let)\\s+([_$[:alpha:]][_$[:alnum:]]*)\\s*(=)?",
12+
"beginCaptures": {
13+
"1": {
14+
"name": "storage.type.ng"
15+
},
16+
"2": {
17+
"name": "meta.definition.variable.ng"
18+
},
19+
"3": {
20+
"name": "keyword.operator.assignment.ng"
21+
}
22+
},
23+
"patterns": [
24+
{
25+
"include": "#letInitializer"
26+
}
27+
],
28+
"contentName": "meta.definition.variable.ng",
29+
"end": "(?<=;)"
30+
},
31+
"letInitializer": {
32+
"begin": "\\s*",
33+
"beginCaptures": {
34+
"0": {
35+
"name": "keyword.operator.assignment.ng"
36+
}
37+
},
38+
"contentName": "meta.definition.variable.initializer.ng",
39+
"patterns": [
40+
{
41+
"include": "expression.ng"
42+
}
43+
],
44+
"end": ";",
45+
"endCaptures": {
46+
"0": {
47+
"name": "punctuation.terminator.statement.ng"
48+
}
49+
}
50+
}
51+
}
52+
}

grammars/angular/syntaxes/template-blocks.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"name": "keyword.control.block.transition.ng"
1313
},
1414
"block": {
15-
"begin": "(@)((?:\\w+\\s*)+)(?=\\(|\\{)",
15+
"begin": "(@)(if|else if|else|defer|placeholder|loading|error|switch|case|default|for|empty)(?:\\s*)",
1616
"beginCaptures": {
1717
"1": {
1818
"patterns": [
@@ -33,7 +33,7 @@
3333
"include": "#blockBody"
3434
}
3535
],
36-
"contentName": "control.block.ng",
36+
"name": "control.block.ng",
3737
"end": "(?<=\\})"
3838
},
3939
"blockExpression": {
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
{
2+
"scopeName": "template.tag.ng",
3+
"injectionSelector": "L:text.html#meta.tag -comment",
4+
"patterns": [
5+
{
6+
"include": "#propertyBinding"
7+
},
8+
{
9+
"include": "#eventBinding"
10+
},
11+
{
12+
"include": "#twoWayBinding"
13+
},
14+
{
15+
"include": "#templateBinding"
16+
}
17+
],
18+
"repository": {
19+
"propertyBinding": {
20+
"begin": "(\\[\\s*@?[-_a-zA-Z0-9.$]*%?\\s*])(=)([\"'])",
21+
"beginCaptures": {
22+
"1": {
23+
"name": "entity.other.attribute-name.html entity.other.ng-binding-name.property.html",
24+
"patterns": [
25+
{
26+
"include": "#bindingKey"
27+
}
28+
]
29+
},
30+
"2": {
31+
"name": "punctuation.separator.key-value.html"
32+
},
33+
"3": {
34+
"name": "string.quoted.html punctuation.definition.string.begin.html"
35+
}
36+
},
37+
"end": "\\3",
38+
"endCaptures": {
39+
"0": {
40+
"name": "string.quoted.html punctuation.definition.string.end.html"
41+
}
42+
},
43+
"name": "meta.ng-binding.property.html",
44+
"contentName": "expression.ng",
45+
"patterns": [
46+
{
47+
"include": "expression.ng"
48+
}
49+
]
50+
},
51+
"eventBinding": {
52+
"begin": "(\\(\\s*@?[-_a-zA-Z0-9.$]*\\s*\\))(=)([\"'])",
53+
"beginCaptures": {
54+
"1": {
55+
"name": "entity.other.attribute-name.html entity.other.ng-binding-name.event.html",
56+
"patterns": [
57+
{
58+
"include": "#bindingKey"
59+
}
60+
]
61+
},
62+
"2": {
63+
"name": "punctuation.separator.key-value.html"
64+
},
65+
"3": {
66+
"name": "string.quoted.html punctuation.definition.string.begin.html"
67+
}
68+
},
69+
"end": "\\3",
70+
"endCaptures": {
71+
"0": {
72+
"name": "string.quoted.html punctuation.definition.string.end.html"
73+
}
74+
},
75+
"name": "meta.ng-binding.event.html",
76+
"contentName": "expression.ng",
77+
"patterns": [
78+
{
79+
"include": "expression.ng"
80+
}
81+
]
82+
},
83+
"twoWayBinding": {
84+
"begin": "(\\[\\s*\\(\\s*@?[-_a-zA-Z0-9.$]*\\s*\\)\\s*\\])(=)([\"'])",
85+
"beginCaptures": {
86+
"1": {
87+
"name": "entity.other.attribute-name.html entity.other.ng-binding-name.two-way.html",
88+
"patterns": [
89+
{
90+
"include": "#bindingKey"
91+
}
92+
]
93+
},
94+
"2": {
95+
"name": "punctuation.separator.key-value.html"
96+
},
97+
"3": {
98+
"name": "string.quoted.html punctuation.definition.string.begin.html"
99+
}
100+
},
101+
"end": "\\3",
102+
"endCaptures": {
103+
"0": {
104+
"name": "string.quoted.html punctuation.definition.string.end.html"
105+
}
106+
},
107+
"name": "meta.ng-binding.two-way.html",
108+
"contentName": "expression.ng",
109+
"patterns": [
110+
{
111+
"include": "expression.ng"
112+
}
113+
]
114+
},
115+
"templateBinding": {
116+
"begin": "(\\*[-_a-zA-Z0-9.$]*)(=)([\"'])",
117+
"beginCaptures": {
118+
"1": {
119+
"name": "entity.other.attribute-name.html entity.other.ng-binding-name.template.html",
120+
"patterns": [
121+
{
122+
"include": "#bindingKey"
123+
}
124+
]
125+
},
126+
"2": {
127+
"name": "punctuation.separator.key-value.html"
128+
},
129+
"3": {
130+
"name": "string.quoted.html punctuation.definition.string.begin.html"
131+
}
132+
},
133+
"end": "\\3",
134+
"endCaptures": {
135+
"0": {
136+
"name": "string.quoted.html punctuation.definition.string.end.html"
137+
}
138+
},
139+
"name": "meta.ng-binding.template.html",
140+
"contentName": "expression.ng",
141+
"patterns": [
142+
{
143+
"include": "expression.ng"
144+
}
145+
]
146+
},
147+
"bindingKey": {
148+
"patterns": [
149+
{
150+
"match": "([\\[\\(]{1,2}|\\*)(?:\\s*)(@?[-_a-zA-Z0-9.$]*%?)(?:\\s*)([\\]\\)]{1,2})?",
151+
"captures": {
152+
"1": {
153+
"name": "punctuation.definition.ng-binding-name.begin.html"
154+
},
155+
"2": {
156+
"name": "entity.other.ng-binding-name.$2.html",
157+
"patterns": [
158+
{
159+
"match": "\\.",
160+
"name": "punctuation.accessor.html"
161+
}
162+
]
163+
},
164+
"3": {
165+
"name": "punctuation.definition.ng-binding-name.end.html"
166+
}
167+
}
168+
}
169+
]
170+
}
171+
}
172+
}

0 commit comments

Comments
 (0)