Skip to content

Commit 05f7ff0

Browse files
committed
Merge remote-tracking branch 'origin/master' into issue_38
2 parents 4e02ec1 + 8a30ca9 commit 05f7ff0

File tree

7 files changed

+102
-43
lines changed

7 files changed

+102
-43
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,16 @@ repository:
154154

155155
method-declaration:
156156
name: meta.method.declaration.ts
157-
begin: '\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<)'
157+
begin: '\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:\b(constructor)\b)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<)'
158158
beginCaptures:
159-
'1': { name: storage.modifier.ts }
160-
'2': { name: storage.modifier.ts }
161-
'3': { name: storage.modifier.ts }
162-
'4': { name: storage.type.property.ts }
163-
'5': { name: keyword.operator.ts }
164-
'6': { name: entity.name.function.ts }
165-
'7': { name: keyword.operator.ts }
159+
'1': { name: storage.modifier.ts } # captures keyword (abstract)
160+
'2': { name: storage.modifier.ts } # captures keyword (public or private or protected)
161+
'3': { name: storage.modifier.ts } # captures keyword (async)
162+
'4': { name: storage.type.property.ts } # captures keyword (get|set)
163+
'5': { name: keyword.operator.ts } # captures keyword (new)
164+
'6': { name: support.type.ts } # captures keyword (constructor)
165+
'7': { name: entity.name.function.ts } # captures method name ([a-zA-Z_$][\.\w$]*)
166+
'8': { name: keyword.operator.ts } # captures (\??)
166167
end: '(?=\}|;|,)|(?<=\})'
167168
patterns:
168169
- include: '#comment'
@@ -174,15 +175,16 @@ repository:
174175

175176
method-overload-declaration:
176177
name: meta.method.overload.declaration.ts
177-
match: '\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<)'
178+
match: '\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:\b(constructor)\b)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<)'
178179
captures:
179-
'1': { name: storage.modifier.ts }
180-
'2': { name: storage.modifier.ts }
181-
'3': { name: storage.modifier.ts }
182-
'4': { name: storage.type.property.ts }
183-
'5': { name: keyword.operator.ts }
184-
'6': { name: entity.name.function.ts }
185-
'7': { name: keyword.operator.ts }
180+
'1': { name: storage.modifier.ts } # captures keyword (abstract)
181+
'2': { name: storage.modifier.ts } # captures keyword (public or private or protected)
182+
'3': { name: storage.modifier.ts } # captures keyword (async)
183+
'4': { name: storage.type.property.ts } # captures keyword (get|set)
184+
'5': { name: keyword.operator.ts } # captures keyword (new)
185+
'6': { name: support.type.ts } # captures keyword (constructor)
186+
'7': { name: entity.name.function.ts } # captures method name ([a-zA-Z_$][\.\w$]*)
187+
'8': { name: keyword.operator.ts } # captures (\??)
186188

187189
indexer-declaration:
188190
name: meta.indexer.declaration.ts

TypeScript.tmLanguage

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@
715715
<key>method-declaration</key>
716716
<dict>
717717
<key>begin</key>
718-
<string>\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\&lt;)</string>
718+
<string>\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:\b(constructor)\b)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\&lt;)</string>
719719
<key>beginCaptures</key>
720720
<dict>
721721
<key>1</key>
@@ -746,9 +746,14 @@
746746
<key>6</key>
747747
<dict>
748748
<key>name</key>
749-
<string>entity.name.function.ts</string>
749+
<string>support.type.ts</string>
750750
</dict>
751751
<key>7</key>
752+
<dict>
753+
<key>name</key>
754+
<string>entity.name.function.ts</string>
755+
</dict>
756+
<key>8</key>
752757
<dict>
753758
<key>name</key>
754759
<string>keyword.operator.ts</string>
@@ -818,16 +823,21 @@
818823
<key>6</key>
819824
<dict>
820825
<key>name</key>
821-
<string>entity.name.function.ts</string>
826+
<string>support.type.ts</string>
822827
</dict>
823828
<key>7</key>
829+
<dict>
830+
<key>name</key>
831+
<string>entity.name.function.ts</string>
832+
</dict>
833+
<key>8</key>
824834
<dict>
825835
<key>name</key>
826836
<string>keyword.operator.ts</string>
827837
</dict>
828838
</dict>
829839
<key>match</key>
830-
<string>\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\&lt;)</string>
840+
<string>\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:\b(constructor)\b)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\&lt;)</string>
831841
<key>name</key>
832842
<string>meta.method.overload.declaration.ts</string>
833843
</dict>

TypeScriptReact.YAML-tmLanguage

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,16 @@ repository:
156156

157157
method-declaration:
158158
name: meta.method.declaration.tsx
159-
begin: '\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<)'
160-
beginCaptures:
161-
'1': { name: storage.modifier.tsx }
162-
'2': { name: storage.modifier.tsx }
163-
'3': { name: storage.modifier.tsx }
164-
'4': { name: storage.type.property.tsx }
165-
'5': { name: keyword.operator.tsx }
166-
'6': { name: entity.name.function.tsx }
167-
'7': { name: keyword.operator.tsx }
159+
begin: '\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:\b(constructor)\b)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<)'
160+
beginCaptures:
161+
'1': { name: storage.modifier.tsx } # captures keyword (abstract)
162+
'2': { name: storage.modifier.tsx } # captures keyword (public or private or protected)
163+
'3': { name: storage.modifier.tsx } # captures keyword (async)
164+
'4': { name: storage.type.property.tsx } # captures keyword (get|set)
165+
'5': { name: keyword.operator.tsx } # captures keyword (new)
166+
'6': { name: support.type.tsx } # captures keyword (constructor)
167+
'7': { name: entity.name.function.tsx } # captures method name ([a-zA-Z_$][\.\w$]*)
168+
'8': { name: keyword.operator.tsx } # captures (\??)
168169
end: '(?=\}|;|,)|(?<=\})'
169170
patterns:
170171
- include: '#comment'
@@ -176,15 +177,16 @@ repository:
176177

177178
method-overload-declaration:
178179
name: meta.method.overload.declaration.tsx
179-
match: '\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<)'
180+
match: '\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:\b(constructor)\b)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<)'
180181
captures:
181-
'1': { name: storage.modifier.tsx }
182-
'2': { name: storage.modifier.tsx }
183-
'3': { name: storage.modifier.tsx }
184-
'4': { name: storage.type.property.tsx }
185-
'5': { name: keyword.operator.tsx }
186-
'6': { name: entity.name.function.tsx }
187-
'7': { name: keyword.operator.tsx }
182+
'1': { name: storage.modifier.tsx } # captures keyword (abstract)
183+
'2': { name: storage.modifier.tsx } # captures keyword (public or private or protected)
184+
'3': { name: storage.modifier.tsx } # captures keyword (async)
185+
'4': { name: storage.type.property.tsx } # captures keyword (get|set)
186+
'5': { name: keyword.operator.tsx } # captures keyword (new)
187+
'6': { name: support.type.tsx } # captures keyword (constructor)
188+
'7': { name: entity.name.function.tsx } # captures method name ([a-zA-Z_$][\.\w$]*)
189+
'8': { name: keyword.operator.tsx } # captures (\??)
188190

189191
indexer-declaration:
190192
name: meta.indexer.declaration.tsx

TypeScriptReact.tmLanguage

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@
10811081
<key>method-declaration</key>
10821082
<dict>
10831083
<key>begin</key>
1084-
<string>\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\&lt;)</string>
1084+
<string>\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:\b(constructor)\b)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\&lt;)</string>
10851085
<key>beginCaptures</key>
10861086
<dict>
10871087
<key>1</key>
@@ -1112,9 +1112,14 @@
11121112
<key>6</key>
11131113
<dict>
11141114
<key>name</key>
1115-
<string>entity.name.function.tsx</string>
1115+
<string>support.type.tsx</string>
11161116
</dict>
11171117
<key>7</key>
1118+
<dict>
1119+
<key>name</key>
1120+
<string>entity.name.function.tsx</string>
1121+
</dict>
1122+
<key>8</key>
11181123
<dict>
11191124
<key>name</key>
11201125
<string>keyword.operator.tsx</string>
@@ -1184,16 +1189,21 @@
11841189
<key>6</key>
11851190
<dict>
11861191
<key>name</key>
1187-
<string>entity.name.function.tsx</string>
1192+
<string>support.type.tsx</string>
11881193
</dict>
11891194
<key>7</key>
1195+
<dict>
1196+
<key>name</key>
1197+
<string>entity.name.function.tsx</string>
1198+
</dict>
1199+
<key>8</key>
11901200
<dict>
11911201
<key>name</key>
11921202
<string>keyword.operator.tsx</string>
11931203
</dict>
11941204
</dict>
11951205
<key>match</key>
1196-
<string>\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\&lt;)</string>
1206+
<string>\b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:\b(constructor)\b)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\&lt;)</string>
11971207
<key>name</key>
11981208
<string>meta.method.overload.declaration.tsx</string>
11991209
</dict>

tests/baselines/Issue191.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[2, 5]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts entity.name.function.ts
1+
[2, 5]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts support.type.ts
22
[2, 17]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts parameter.name.ts storage.modifier.ts
33
[2, 24]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts parameter.name.ts variable.parameter.ts
44
[2, 33]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts meta.type.annotation.ts meta.type.primitive.ts support.type.ts
@@ -15,7 +15,7 @@
1515
[6, 60]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts meta.block.ts meta.brace.paren.ts
1616
[11, 13]: source.ts meta.declaration.object.ts meta.type.parameters.ts meta.type.name.ts
1717
[11, 16]: source.ts meta.declaration.object.ts meta.type.parameters.ts meta.type.name.ts
18-
[12, 5]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts entity.name.function.ts
18+
[12, 5]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts support.type.ts
1919
[12, 17]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts parameter.name.ts storage.modifier.ts
2020
[12, 24]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts parameter.name.ts variable.parameter.ts
2121
[12, 33]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts meta.type.annotation.ts meta.type.primitive.ts support.type.ts

tests/baselines/Issue32.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[5, 1]: source.ts meta.declaration.object.ts storage.type.ts
2+
[5, 11]: source.ts meta.declaration.object.ts meta.object.name.ts entity.name.class.ts
3+
[6, 2]: source.ts meta.declaration.object.ts meta.object.body.ts meta.field.declaration.ts variable.ts
4+
[7, 2]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts entity.name.function.ts
5+
[11, 1]: source.ts meta.declaration.object.ts storage.type.ts
6+
[12, 2]: source.ts meta.declaration.object.ts meta.object.body.ts meta.field.declaration.ts variable.ts
7+
[13, 2]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts entity.name.function.ts
8+
[14, 3]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts constant.language.this.ts
9+
[16, 2]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts support.type.ts
10+
[16, 14]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts parameter.name.ts variable.parameter.ts
11+
[16, 17]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts meta.type.annotation.ts meta.type.primitive.ts support.type.ts
12+
[16, 25]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts parameter.name.ts variable.parameter.ts
13+
[16, 28]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts meta.type.annotation.ts meta.type.primitive.ts support.type.ts
14+
[18, 1]: source.ts

tests/cases/Issue32.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Testing Isuue 32: Adding constructor as a support.type keword
3+
*/
4+
5+
^^interface ^^NewInterface{
6+
^^currentData: Data;
7+
^^setVal(d: Data)
8+
}
9+
10+
11+
^^class NewClass implements NewInterface {
12+
^^currentData: Data;
13+
^^setVal(d: Data){
14+
^^this.currentData = d;
15+
}
16+
^^constructor(^^m: ^^number, ^^n: ^^string){}
17+
}
18+
^^
19+
/*
20+
Testing comments
21+
*/

0 commit comments

Comments
 (0)