Skip to content

Commit 0cab1cc

Browse files
committed
Fix the new expression end regex
1 parent 21d57cb commit 0cab1cc

10 files changed

+1216
-8
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ repository:
912912
beginCaptures:
913913
'1': { name: keyword.operator.new.ts }
914914
# new-expr ends just before any type or call arguments. Type arguments will be picked up by #cast.
915-
end: '(?=[(;]|$)'
915+
end: '(?=[(;),]|$)'
916916
patterns:
917917
- include: '#type'
918918
- include: '#comment'
@@ -984,7 +984,7 @@ repository:
984984
captures:
985985
'1': { name: variable.parameter.ts }
986986
- name: meta.arrow.ts
987-
begin: (?x)(?<=return|throw|yield|await|async|[=(,:>*])\s*(?=\(([^()]+|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>)
987+
begin: (?x)(?<=return|throw|yield|await|async|[=(\[,:>*])\s*(?=\(([^()]+|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>)
988988
end: (?==>)
989989
patterns:
990990
- include: '#function-parameters'

TypeScript.tmLanguage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
</dict>
183183
<dict>
184184
<key>begin</key>
185-
<string>(?x)(?&lt;=return|throw|yield|await|async|[=(,:&gt;*])\s*(?=\(([^()]+|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=&gt;)</string>
185+
<string>(?x)(?&lt;=return|throw|yield|await|async|[=(\[,:&gt;*])\s*(?=\(([^()]+|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=&gt;)</string>
186186
<key>end</key>
187187
<string>(?==&gt;)</string>
188188
<key>name</key>
@@ -2151,7 +2151,7 @@
21512151
</dict>
21522152
</dict>
21532153
<key>end</key>
2154-
<string>(?=[(;]|$)</string>
2154+
<string>(?=[(;),]|$)</string>
21552155
<key>name</key>
21562156
<string>new.expr.ts</string>
21572157
<key>patterns</key>

TypeScriptReact.YAML-tmLanguage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ repository:
902902
beginCaptures:
903903
'1': { name: keyword.operator.new.tsx }
904904
# new-expr ends just before any type or call arguments. Type arguments will be picked up by #cast.
905-
end: '(?=[(;]|$)'
905+
end: '(?=[(;),]|$)'
906906
patterns:
907907
- include: '#type'
908908
- include: '#comment'
@@ -974,7 +974,7 @@ repository:
974974
captures:
975975
'1': { name: variable.parameter.tsx }
976976
- name: meta.arrow.tsx
977-
begin: (?x)(?<=return|throw|yield|await|async|[=(,:>*])\s*(?=\(([^()]+|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>)
977+
begin: (?x)(?<=return|throw|yield|await|async|[=(\[,:>*])\s*(?=\(([^()]+|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>)
978978
end: (?==>)
979979
patterns:
980980
- include: '#function-parameters'

TypeScriptReact.tmLanguage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
</dict>
183183
<dict>
184184
<key>begin</key>
185-
<string>(?x)(?&lt;=return|throw|yield|await|async|[=(,:&gt;*])\s*(?=\(([^()]+|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=&gt;)</string>
185+
<string>(?x)(?&lt;=return|throw|yield|await|async|[=(\[,:&gt;*])\s*(?=\(([^()]+|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=&gt;)</string>
186186
<key>end</key>
187187
<string>(?==&gt;)</string>
188188
<key>name</key>
@@ -2537,7 +2537,7 @@
25372537
</dict>
25382538
</dict>
25392539
<key>end</key>
2540-
<string>(?=[(;]|$)</string>
2540+
<string>(?=[(;),]|$)</string>
25412541
<key>name</key>
25422542
<string>new.expr.tsx</string>
25432543
<key>patterns</key>

tests/baselines/Issue230.baseline.txt

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

tests/baselines/Issue248.baseline.txt

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

tests/baselines/Issue250.baseline.txt

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

tests/cases/Issue230.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Note: `new Date` without parenthesis (`new Date()`)
2+
ctrl.filter("dateFilter", () => (input: mycivis.IAll[], date: Date = new Date) => input.filter((value, index, array) => {
3+
let date2 = value.date || (value.day) ? moment(`${value.day} ${value.time}`, "YYYY-MM-DD HH:mm").toDate() : next_wday(value.wday);
4+
5+
return moment(date).format("DD/MMM/YYYY") === moment(date2).format("DD/MMM/YYYY");
6+
}));

tests/cases/Issue248.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
class C1 {
2+
m1 = 1;
3+
static s1() {
4+
return [() => (new this).m1];
5+
}
6+
}
7+
class C2 {
8+
m1 = 1;
9+
static s1() {
10+
return [() => (new this).m1];
11+
}
12+
}
13+
class C3 {
14+
m1 = 1;
15+
static s1() {
16+
return [() => (new this).m1];
17+
}
18+
}
19+
class C4 {
20+
m1 = 1;
21+
static s1() {
22+
return [() => (new this).m1];
23+
}
24+
}
25+
class C5 {
26+
m1 = 1;
27+
static s1() {
28+
return [() => (new this).m1];
29+
}
30+
}
31+
class C6 {
32+
m1 = 1;
33+
static s1() {
34+
return [() => (new this).m1];
35+
}
36+
}

tests/cases/Issue250.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/** Meta-part that defins a Form */
2+
export class FormType extends Type {
3+
4+
/** @internal Original FormType instance */
5+
static Original = function () {
6+
let type = new FormType;
7+
8+
// define embed field
9+
type.defineField(DesignID.Embed, new BooleanAtom(false));
10+
11+
// define plan choice
12+
type.defineField(DesignID.Plan, PlanChoice.Original);
13+
14+
// define fields list
15+
let fields =
16+
type.defineField(DesignID.Fields, new Ordering(new FieldDesign));
17+
// embed field list
18+
fields.embed = true;
19+
20+
return type;
21+
} ();
22+
}

0 commit comments

Comments
 (0)