Skip to content

Commit a5498c8

Browse files
committed
fixup! fix(syntaxes): Do not highlight bindings outside element tags
1 parent 18db8ea commit a5498c8

File tree

7 files changed

+737
-787
lines changed

7 files changed

+737
-787
lines changed

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,9 @@
189189
"path": "./syntaxes/template-tag.json",
190190
"scopeName": "template.tag.ng",
191191
"injectTo": [
192-
"text.html.derivative"
193-
],
194-
"embeddedLanguages": {
195-
"text.html": "html"
196-
}
192+
"text.html.derivative",
193+
"source.ts"
194+
]
197195
},
198196
{
199197
"path": "./syntaxes/expression.json",

syntaxes/test/data/expression.html

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -79,25 +79,6 @@
7979
<!-- Don't match nullish coalesce -->
8080
{{ condition ?? (a ? 1 : 2) }}
8181

82-
<!-- Microsyntax -->
83-
<!-- Let Expression -->
84-
<div *ngFor="let i = index;"></div>
85-
<div *ngFor="let i = index"></div>
86-
<!-- Key Expression -->
87-
<div *ngFor="let i = index; trackBy: hash;"></div>
88-
<div *ngFor="let i = index; trackBy: hash"></div>
89-
<div *ngFor="let param of params;"></div>
90-
<div *ngFor="let param of params"></div>
91-
<!-- As Expression -->
92-
<div *ngFor="let param of params; index as i;"></div>
93-
<div *ngFor="let param of params; index as i"></div>
94-
<div *ngIf='x as y'></div>
95-
<!-- Mixed -->
96-
<div *ngFor="let param of params; let i = index; let last = last"></div>
97-
<div *ngFor="let param of params; let i = index; let last = last;"></div>
98-
<div *ngFor="let param of params; let i = index; last as last"></div>
99-
<div *ngFor="let param of params; let i = index; last as last;"></div>
100-
10182
<!-- Pipes -->
10283
{{ (let param of params) | async }}
10384
{{ (let param of params) | trackBy: trackByMethod }}
@@ -111,9 +92,3 @@
11192
{{ (let param of params?.get('value')!.property | async).anotherProperty | translate: ['language1', 'language2']; let i
11293
= index; }}
11394

114-
<!-- Regression -->
115-
<!-- #575 -->
116-
<div *ngFor="let n of nums; index as i"></div>
117-
<div *matHeaderCellDef></div>
118-
<!-- #613 -->
119-
<div *ngIf="x$ | async as a"></div>

syntaxes/test/data/expression.html.snap

Lines changed: 0 additions & 336 deletions
Large diffs are not rendered by default.

syntaxes/test/data/inline-template.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,3 @@ export class TMComponent{}
3030
template: '{{property}}',
3131
})
3232
export class TMComponent{}
33-
34-
@Component({
35-
template: `
36-
<ng-container *ngFor="let el of [1,2,3,4]; template: myTpl"></ng-template>
37-
`,
38-
})
39-
export class TMComponent{}

syntaxes/test/data/inline-template.ts.snap

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -117,48 +117,4 @@
117117
#^^^ inline-template.ng
118118
>export class TMComponent{}
119119
#^^^^^^^^^^^^^^^^^^^^^^^^^^^ inline-template.ng
120-
>
121-
>@Component({
122-
#^^^^^^^^^^^^^ inline-template.ng
123-
> template: `
124-
#^^ inline-template.ng
125-
# ^^^^^^^^ inline-template.ng meta.object-literal.key.ts
126-
# ^ inline-template.ng meta.object-literal.key.ts punctuation.separator.key-value.ts
127-
# ^ inline-template.ng
128-
# ^ inline-template.ng string
129-
> <ng-container *ngFor="let el of [1,2,3,4]; template: myTpl"></ng-template>
130-
#^^^^^^^^^^^^^^^^^^ inline-template.ng text.html
131-
# ^ inline-template.ng text.html meta.ng-binding.template.html entity.other.attribute-name.html entity.other.ng-binding-name.template.html punctuation.definition.ng-binding-name.begin.html
132-
# ^^^^^ inline-template.ng text.html meta.ng-binding.template.html entity.other.attribute-name.html entity.other.ng-binding-name.template.html entity.other.ng-binding-name.ngFor.html
133-
# ^ inline-template.ng text.html meta.ng-binding.template.html punctuation.separator.key-value.html
134-
# ^ inline-template.ng text.html meta.ng-binding.template.html string.quoted.html punctuation.definition.string.begin.html
135-
# ^^^ inline-template.ng text.html meta.ng-binding.template.html expression.ng storage.type.ts
136-
# ^ inline-template.ng text.html meta.ng-binding.template.html expression.ng
137-
# ^^ inline-template.ng text.html meta.ng-binding.template.html expression.ng variable.other.readwrite.ts
138-
# ^ inline-template.ng text.html meta.ng-binding.template.html expression.ng
139-
# ^^ inline-template.ng text.html meta.ng-binding.template.html expression.ng keyword.operator.expression.of.ts
140-
# ^ inline-template.ng text.html meta.ng-binding.template.html expression.ng
141-
# ^ inline-template.ng text.html meta.ng-binding.template.html expression.ng meta.array.literal.ts meta.brace.square.ts
142-
# ^ inline-template.ng text.html meta.ng-binding.template.html expression.ng meta.array.literal.ts constant.numeric.decimal.ts
143-
# ^ inline-template.ng text.html meta.ng-binding.template.html expression.ng meta.array.literal.ts punctuation.separator.comma.ts
144-
# ^ inline-template.ng text.html meta.ng-binding.template.html expression.ng meta.array.literal.ts constant.numeric.decimal.ts
145-
# ^ inline-template.ng text.html meta.ng-binding.template.html expression.ng meta.array.literal.ts punctuation.separator.comma.ts
146-
# ^ inline-template.ng text.html meta.ng-binding.template.html expression.ng meta.array.literal.ts constant.numeric.decimal.ts
147-
# ^ inline-template.ng text.html meta.ng-binding.template.html expression.ng meta.array.literal.ts punctuation.separator.comma.ts
148-
# ^ inline-template.ng text.html meta.ng-binding.template.html expression.ng meta.array.literal.ts constant.numeric.decimal.ts
149-
# ^ inline-template.ng text.html meta.ng-binding.template.html expression.ng meta.array.literal.ts meta.brace.square.ts
150-
# ^^ inline-template.ng text.html meta.ng-binding.template.html expression.ng
151-
# ^^^^^^^^ inline-template.ng text.html meta.ng-binding.template.html expression.ng variable.other.readwrite.ts
152-
# ^^ inline-template.ng text.html meta.ng-binding.template.html expression.ng
153-
# ^^^^^ inline-template.ng text.html meta.ng-binding.template.html expression.ng variable.other.readwrite.ts
154-
# ^ inline-template.ng text.html meta.ng-binding.template.html string.quoted.html punctuation.definition.string.end.html
155-
# ^^^^^^^^^^^^^^^^ inline-template.ng text.html
156-
> `,
157-
#^^ inline-template.ng text.html
158-
# ^ inline-template.ng string
159-
# ^^ inline-template.ng
160-
>})
161-
#^^^ inline-template.ng
162-
>export class TMComponent{}
163-
#^^^^^^^^^^^^^^^^^^^^^^^^^^^ inline-template.ng
164120
>

syntaxes/test/data/template-tag.html

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,30 @@
4949
<my-component *custom-if="true != false"></my-component>
5050
<my-component *custom_if="true != false"></my-component>
5151
<my-component *custom_$if="true != false"></my-component>
52-
<my-component *%invalid="expr"></my-component>
52+
<my-component *%invalid="expr"></my-component>
53+
54+
<!-- Microsyntax -->
55+
<!-- Let Expression -->
56+
<div *ngFor="let i = index;"></div>
57+
<div *ngFor="let i = index"></div>
58+
<!-- Key Expression -->
59+
<div *ngFor="let i = index; trackBy: hash;"></div>
60+
<div *ngFor="let i = index; trackBy: hash"></div>
61+
<div *ngFor="let param of params;"></div>
62+
<div *ngFor="let param of params"></div>
63+
<!-- As Expression -->
64+
<div *ngFor="let param of params; index as i;"></div>
65+
<div *ngFor="let param of params; index as i"></div>
66+
<div *ngIf='x as y'></div>
67+
<!-- Mixed -->
68+
<div *ngFor="let param of params; let i = index; let last = last"></div>
69+
<div *ngFor="let param of params; let i = index; let last = last;"></div>
70+
<div *ngFor="let param of params; let i = index; last as last"></div>
71+
<div *ngFor="let param of params; let i = index; last as last;"></div>
72+
73+
<!-- Regression -->
74+
<!-- #575 -->
75+
<div *ngFor="let n of nums; index as i"></div>
76+
<div *matHeaderCellDef></div>
77+
<!-- #613 -->
78+
<div *ngIf="x$ | async as a"></div>

0 commit comments

Comments
 (0)