Skip to content

Commit d7dab52

Browse files
authored
fix(syntaxes): Single quote should end as alias match (#1956)
While uncommon, single quotes can be used for HTML attribute values. fixes #1912
1 parent 075047a commit d7dab52

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

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"

syntaxes/src/expression.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const Expression: GrammarDefinition = {
147147
name: 'storage.type.as.ts',
148148
},
149149
},
150-
end: /(?=$|"|[;,:})\]])/,
150+
end: /(?=$|"|'|[;,:})\]])/,
151151
patterns: [
152152
{
153153
include: '#type',

syntaxes/test/data/expression.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
<!-- As Expression -->
9292
<div *ngFor="let param of params; index as i;"></div>
9393
<div *ngFor="let param of params; index as i"></div>
94+
<div *ngIf='x as y'></div>
9495
<!-- Mixed -->
9596
<div *ngFor="let param of params; let i = index; let last = last"></div>
9697
<div *ngFor="let param of params; let i = index; let last = last;"></div>
@@ -115,4 +116,4 @@
115116
<div *ngFor="let n of nums; index as i"></div>
116117
<div *matHeaderCellDef></div>
117118
<!-- #613 -->
118-
<div *ngIf="x$ | async as a"></div>
119+
<div *ngIf="x$ | async as a"></div>

syntaxes/test/data/expression.html.snap

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,19 @@
10251025
# ^ template.ng meta.ng-binding.template.html expression.ng entity.name.type.ts
10261026
# ^ template.ng meta.ng-binding.template.html string.quoted.html punctuation.definition.string.end.html
10271027
# ^^^^^^^^ template.ng
1028+
><div *ngIf='x as y'></div>
1029+
#^^^^^ template.ng
1030+
# ^ template.ng meta.ng-binding.template.html entity.other.attribute-name.html entity.other.ng-binding-name.template.html punctuation.definition.ng-binding-name.begin.html
1031+
# ^^^^ template.ng meta.ng-binding.template.html entity.other.attribute-name.html entity.other.ng-binding-name.template.html entity.other.ng-binding-name.ngIf.html
1032+
# ^ template.ng meta.ng-binding.template.html punctuation.separator.key-value.html
1033+
# ^ template.ng meta.ng-binding.template.html string.quoted.html punctuation.definition.string.begin.html
1034+
# ^ template.ng meta.ng-binding.template.html expression.ng variable.other.readwrite.ts
1035+
# ^ template.ng meta.ng-binding.template.html expression.ng
1036+
# ^^ template.ng meta.ng-binding.template.html expression.ng storage.type.as.ts
1037+
# ^ template.ng meta.ng-binding.template.html expression.ng
1038+
# ^ template.ng meta.ng-binding.template.html expression.ng entity.name.type.ts
1039+
# ^ template.ng meta.ng-binding.template.html string.quoted.html punctuation.definition.string.end.html
1040+
# ^^^^^^^^ template.ng
10281041
><!-- Mixed -->
10291042
#^^^^^^^^^^^^^^^ template.ng
10301043
><div *ngFor="let param of params; let i = index; let last = last"></div>
@@ -1453,4 +1466,5 @@
14531466
# ^ template.ng meta.ng-binding.template.html expression.ng
14541467
# ^ template.ng meta.ng-binding.template.html expression.ng entity.name.type.ts
14551468
# ^ template.ng meta.ng-binding.template.html string.quoted.html punctuation.definition.string.end.html
1456-
# ^^^^^^^^ template.ng
1469+
# ^^^^^^^^ template.ng
1470+
>

0 commit comments

Comments
 (0)