Skip to content

Commit 34b2509

Browse files
committed
identifier.prototype makes identifier a class
1 parent 7ea0312 commit 34b2509

File tree

6 files changed

+60
-1
lines changed

6 files changed

+60
-1
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,9 @@ repository:
12301230

12311231
identifiers:
12321232
patterns:
1233+
# class
1234+
- name: support.class.ts
1235+
match: ([_$[:alpha:]][_$[:alnum:]]*)(?=\s*\.\s*prototype\b(?!\$))
12331236
# object properties
12341237
- match: |-
12351238
(?x)(\.)\s*(?:

TypeScript.tmLanguage

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3431,6 +3431,12 @@
34313431
<dict>
34323432
<key>patterns</key>
34333433
<array>
3434+
<dict>
3435+
<key>name</key>
3436+
<string>support.class.ts</string>
3437+
<key>match</key>
3438+
<string>([_$[:alpha:]][_$[:alnum:]]*)(?=\s*\.\s*prototype\b(?!\$))</string>
3439+
</dict>
34343440
<dict>
34353441
<key>match</key>
34363442
<string>(?x)(\.)\s*(?:

TypeScriptReact.tmLanguage

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3435,6 +3435,12 @@
34353435
<dict>
34363436
<key>patterns</key>
34373437
<array>
3438+
<dict>
3439+
<key>name</key>
3440+
<string>support.class.tsx</string>
3441+
<key>match</key>
3442+
<string>([_$[:alpha:]][_$[:alnum:]]*)(?=\s*\.\s*prototype\b(?!\$))</string>
3443+
</dict>
34383444
<dict>
34393445
<key>match</key>
34403446
<string>(?x)(\.)\s*(?:

tests/baselines/Issue191.baseline.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,4 +427,4 @@ Grammar: TypeScript.tmLanguage
427427
source.ts meta.class.ts punctuation.definition.block.ts
428428
>
429429
^
430-
source.ts
430+
source.ts
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
original file
2+
-----------------------------------
3+
MyClass.prototype.method = function () {
4+
}
5+
-----------------------------------
6+
7+
Grammar: TypeScript.tmLanguage
8+
-----------------------------------
9+
>MyClass.prototype.method = function () {
10+
^^^^^^^
11+
source.ts support.class.ts
12+
^
13+
source.ts punctuation.accessor.ts
14+
^^^^^^^^^
15+
source.ts support.variable.property.ts
16+
^
17+
source.ts punctuation.accessor.ts
18+
^^^^^^
19+
source.ts support.variable.property.dom.ts
20+
^
21+
source.ts
22+
^
23+
source.ts keyword.operator.assignment.ts
24+
^
25+
source.ts
26+
^^^^^^^^
27+
source.ts meta.function.ts storage.type.function.ts
28+
^
29+
source.ts meta.function.ts
30+
^
31+
source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
32+
^
33+
source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.end.ts
34+
^
35+
source.ts meta.function.ts
36+
^
37+
source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts
38+
^^
39+
source.ts meta.function.ts meta.block.ts
40+
>}
41+
^
42+
source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts

tests/cases/javascriptClasses.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MyClass.prototype.method = function () {
2+
}

0 commit comments

Comments
 (0)