Skip to content

Commit 83052bb

Browse files
committed
Merge remote-tracking branch 'origin/master' into branch_anubha
2 parents 7f05647 + 078f005 commit 83052bb

30 files changed

+321
-268
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# TypeScript-TmLanguage
2+
[![Build status](https://ci.appveyor.com/api/projects/status/i7fp97q9nc5uw5kf?svg=true)](https://ci.appveyor.com/project/zhengbli/typescript-tmlanguage)
23

34
This repository contains TmLanguage files that are consumed by TypeScript editors and plugins such as [Visual Studio Code](https://github.com/Microsoft/vscode), [The TypeScript Sublime Plugin](https://github.com/Microsoft/TypeScript-Sublime-Plugin), [Atom TypeScript](https://github.com/TypeStrong/atom-typescript), and possibly others.
45

@@ -14,4 +15,4 @@ Test are run from within the ```tests``` folder
1415
cd tests
1516
npm install # Installs dependencies required for testing
1617
npm test # Compiles & runs tests
17-
```
18+
```

TypeScript.YAML-tmLanguage

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ repository:
8686

8787
object-heritage:
8888
name: meta.object.heritage.ts
89-
begin: '(?:\b(extends|implements))'
89+
begin: '(?:\b(extends|implements)\b)'
9090
beginCaptures:
9191
'1': { name: keyword.other.ts }
9292
end: (?=\{)
@@ -96,11 +96,11 @@ repository:
9696
- include: '#comment'
9797
- include: '#object-heritage'
9898
- include: '#type-parameters'
99-
- include: '#object-heritage-parent'
99+
- include: '#object-heritage-type'
100100

101-
object-heritage-parent:
101+
object-heritage-type:
102102
name: meta.object.heritage.parent.ts
103-
match: '(?:\s*([a-zA-Z_$][\w$]*))'
103+
match: '(?:\s*([a-zA-Z_$][\w$]*)\b)'
104104
captures:
105105
'1': { name: storage.type.ts }
106106

@@ -487,7 +487,7 @@ repository:
487487

488488
expression-operator:
489489
name: keyword.operator.ts
490-
match: =>|\b(delete|export|import|from|in|instanceof|module|namespace|new|typeof|void|as)\b
490+
match: =>|\b(delete|export|import|from|in|instanceof|new|typeof|void|as)\b
491491

492492
arithmetic-operator:
493493
name: keyword.operator.arithmetic.ts
@@ -507,7 +507,7 @@ repository:
507507

508508
storage-keyword:
509509
name: storage.type.ts
510-
match: \b(number|boolean|string|any|var|let|function|const)\b
510+
match: \b(number|boolean|string|any|var|let|function|const|module|namespace)\b
511511

512512
paren-expression:
513513
begin: \(

TypeScript.tmLanguage

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@
408408
<key>expression-operator</key>
409409
<dict>
410410
<key>match</key>
411-
<string>=&gt;|\b(delete|export|import|from|in|instanceof|module|namespace|new|typeof|void|as)\b</string>
411+
<string>=&gt;|\b(delete|export|import|from|in|instanceof|new|typeof|void|as)\b</string>
412412
<key>name</key>
413413
<string>keyword.operator.ts</string>
414414
</dict>
@@ -998,7 +998,7 @@
998998
<key>object-heritage</key>
999999
<dict>
10001000
<key>begin</key>
1001-
<string>(?:\b(extends|implements))</string>
1001+
<string>(?:\b(extends|implements)\b)</string>
10021002
<key>beginCaptures</key>
10031003
<dict>
10041004
<key>1</key>
@@ -1035,11 +1035,11 @@
10351035
</dict>
10361036
<dict>
10371037
<key>include</key>
1038-
<string>#object-heritage-parent</string>
1038+
<string>#object-heritage-type</string>
10391039
</dict>
10401040
</array>
10411041
</dict>
1042-
<key>object-heritage-parent</key>
1042+
<key>object-heritage-type</key>
10431043
<dict>
10441044
<key>captures</key>
10451045
<dict>
@@ -1050,7 +1050,7 @@
10501050
</dict>
10511051
</dict>
10521052
<key>match</key>
1053-
<string>(?:\s*([a-zA-Z_$][\w$]*))</string>
1053+
<string>(?:\s*([a-zA-Z_$][\w$]*)\b)</string>
10541054
<key>name</key>
10551055
<string>meta.object.heritage.parent.ts</string>
10561056
</dict>
@@ -1241,7 +1241,7 @@
12411241
<key>storage-keyword</key>
12421242
<dict>
12431243
<key>match</key>
1244-
<string>\b(number|boolean|string|any|var|let|function|const)\b</string>
1244+
<string>\b(number|boolean|string|any|var|let|function|const|module|namespace)\b</string>
12451245
<key>name</key>
12461246
<string>storage.type.ts</string>
12471247
</dict>

TypeScriptReact.YAML-tmLanguage

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ repository:
8888

8989
object-heritage:
9090
name: meta.object.heritage.tsx
91-
begin: '(?:\b(extends|implements))'
91+
begin: '(?:\b(extends|implements)\b)'
9292
beginCaptures:
9393
'1': { name: keyword.other.tsx }
9494
end: (?=\{)
@@ -98,11 +98,11 @@ repository:
9898
- include: '#comment'
9999
- include: '#object-heritage'
100100
- include: '#type-parameters'
101-
- include: '#object-heritage-parent'
101+
- include: '#object-heritage-type'
102102

103-
object-heritage-parent:
103+
object-heritage-type:
104104
name: meta.object.heritage.parent.tsx
105-
match: '(?:\s*([a-zA-Z_$][\w$]*))'
105+
match: '(?:\s*([a-zA-Z_$][\w$]*)\b)'
106106
captures:
107107
'1': { name: storage.type.tsx }
108108

@@ -325,7 +325,7 @@ repository:
325325

326326
await-modifier:
327327
name: storage.modifier.tsx
328-
match: 'await'
328+
match: '\bawait\b'
329329

330330
type-operator:
331331
name: keyword.operator.type.tsx
@@ -475,7 +475,7 @@ repository:
475475

476476
expression-operator:
477477
name: keyword.operator.tsx
478-
match: =>|\b(delete|export|import|from|in|instanceof|module|namespace|new|typeof|void|as)\b
478+
match: =>|\b(delete|export|import|from|in|instanceof|new|typeof|void|as)\b
479479

480480
arithmetic-operator:
481481
name: keyword.operator.arithmetic.tsx
@@ -495,7 +495,7 @@ repository:
495495

496496
storage-keyword:
497497
name: storage.type.tsx
498-
match: \b(number|boolean|string|any|var|let|function|const)\b
498+
match: \b(number|boolean|string|any|var|let|function|const|module|namespace)\b
499499

500500
paren-expression:
501501
begin: \(

TypeScriptReact.tmLanguage

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<key>await-modifier</key>
7474
<dict>
7575
<key>match</key>
76-
<string>await</string>
76+
<string>\bawait\b</string>
7777
<key>name</key>
7878
<string>storage.modifier.tsx</string>
7979
</dict>
@@ -376,7 +376,7 @@
376376
<key>expression-operator</key>
377377
<dict>
378378
<key>match</key>
379-
<string>=&gt;|\b(delete|export|import|from|in|instanceof|module|namespace|new|typeof|void|as)\b</string>
379+
<string>=&gt;|\b(delete|export|import|from|in|instanceof|new|typeof|void|as)\b</string>
380380
<key>name</key>
381381
<string>keyword.operator.tsx</string>
382382
</dict>
@@ -1364,7 +1364,7 @@
13641364
<key>object-heritage</key>
13651365
<dict>
13661366
<key>begin</key>
1367-
<string>(?:\b(extends|implements))</string>
1367+
<string>(?:\b(extends|implements)\b)</string>
13681368
<key>beginCaptures</key>
13691369
<dict>
13701370
<key>1</key>
@@ -1401,11 +1401,11 @@
14011401
</dict>
14021402
<dict>
14031403
<key>include</key>
1404-
<string>#object-heritage-parent</string>
1404+
<string>#object-heritage-type</string>
14051405
</dict>
14061406
</array>
14071407
</dict>
1408-
<key>object-heritage-parent</key>
1408+
<key>object-heritage-type</key>
14091409
<dict>
14101410
<key>captures</key>
14111411
<dict>
@@ -1416,7 +1416,7 @@
14161416
</dict>
14171417
</dict>
14181418
<key>match</key>
1419-
<string>(?:\s*([a-zA-Z_$][\w$]*))</string>
1419+
<string>(?:\s*([a-zA-Z_$][\w$]*)\b)</string>
14201420
<key>name</key>
14211421
<string>meta.object.heritage.parent.tsx</string>
14221422
</dict>
@@ -1607,7 +1607,7 @@
16071607
<key>storage-keyword</key>
16081608
<dict>
16091609
<key>match</key>
1610-
<string>\b(number|boolean|string|any|var|let|function|const)\b</string>
1610+
<string>\b(number|boolean|string|any|var|let|function|const|module|namespace)\b</string>
16111611
<key>name</key>
16121612
<string>storage.type.tsx</string>
16131613
</dict>

tests/baselines/Issue89.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[1, 8]: source.ts meta.declaration.object.ts storage.type.ts
2+
[1, 14]: source.ts meta.declaration.object.ts meta.object.name.ts entity.name.class.ts
3+
[1, 16]: source.ts meta.declaration.object.ts meta.object.heritage.ts keyword.other.ts
4+
[1, 27]: source.ts meta.declaration.object.ts meta.object.heritage.ts comment.block.ts
5+
[1, 30]: source.ts meta.declaration.object.ts meta.object.heritage.ts meta.object.heritage.parent.ts storage.type.ts
6+
[1, 32]: source.ts meta.declaration.object.ts meta.object.heritage.ts meta.object.heritage.parent.ts storage.type.ts
7+
[1, 47]: source.ts meta.declaration.object.ts meta.object.heritage.ts meta.object.heritage.parent.ts storage.type.ts
8+
[2, 2]: source.ts meta.declaration.object.ts meta.object.body.ts
9+
[4, 1]: source.ts
10+
[7, 14]: source.ts meta.declaration.object.ts meta.object.name.ts entity.name.class.ts
11+
[7, 16]: source.ts meta.declaration.object.ts meta.object.heritage.ts keyword.other.ts
12+
[7, 31]: source.ts meta.declaration.object.ts meta.object.heritage.ts meta.object.heritage.parent.ts
13+
[7, 34]: source.ts meta.declaration.object.ts meta.object.heritage.ts meta.object.heritage.parent.ts storage.type.ts
14+
[7, 46]: source.ts meta.declaration.object.ts meta.object.heritage.ts meta.object.heritage.parent.ts storage.type.ts
15+
[7, 48]: source.ts meta.declaration.object.ts meta.object.heritage.ts
16+
[8, 2]: source.ts meta.declaration.object.ts meta.object.body.ts
17+
[10, 1]: source.ts
18+
[12, 14]: source.ts meta.declaration.object.ts meta.object.name.ts entity.name.class.ts
19+
[12, 16]: source.ts meta.declaration.object.ts meta.object.heritage.ts keyword.other.ts
20+
[12, 28]: source.ts meta.declaration.object.ts meta.object.heritage.ts meta.object.heritage.parent.ts storage.type.ts
21+
[12, 30]: source.ts meta.declaration.object.ts meta.object.heritage.ts meta.object.heritage.parent.ts
22+
[12, 43]: source.ts meta.declaration.object.ts meta.object.heritage.ts comment.block.ts
23+
[12, 46]: source.ts meta.declaration.object.ts meta.object.heritage.ts meta.object.heritage.parent.ts storage.type.ts
24+
[12, 51]: source.ts meta.declaration.object.ts meta.object.heritage.ts meta.object.heritage.parent.ts storage.type.ts
25+
[12, 56]: source.ts meta.declaration.object.ts meta.object.heritage.ts meta.object.heritage.parent.ts storage.type.ts
26+
[13, 2]: source.ts meta.declaration.object.ts meta.object.body.ts
27+
[15, 1]: source.ts
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[1, 1]: source.ts storage.type.ts
2+
[2, 1]: source.ts storage.type.ts
3+
[3, 9]: source.ts storage.type.ts
4+
[4, 9]: source.ts storage.type.ts
5+
[5, 9]: source.ts storage.type.ts

tests/build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ var register = new vt.Registry();
88
var tsGrammar = register.loadGrammarFromPathSync("../TypeScript.tmLanguage");
99
var tsReactGrammar = register.loadGrammarFromPathSync("../TypeScriptReact.tmLanguage");
1010

11-
const marker = '^';
11+
const marker = '^^';
1212

1313
function deleteCharAt(index: number, str: string) {
14-
return str.slice(0, index) + str.slice(index + 1);
14+
return str.slice(0, index) + str.slice(index + marker.length);
1515
}
1616

1717
function getMarkerLocations(str: string): number[] {

tests/cases/Abstracts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
^abstract class Animal {
1+
^^abstract class Animal {
22
public age: number;
33
public yearsLeft() { return 20 - this.age; }
4-
^abstract makeSound(): string;
4+
^^abstract makeSound(): string;
55
}
66

77
class Cow extends Animal {

tests/cases/ArrowFunctionInsideTypeAssertion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Issue: https://github.com/Microsoft/TypeScript-Sublime-Plugin/issues/292
22

33
var object = {
4-
setTransform: ^<^(^domNode: ^HTMLElement, ^desiredValue: ^string) ^=> ^void>^null,
4+
setTransform: ^^<^^(^^domNode: ^^HTMLElement, ^^desiredValue: ^^string) ^^=> ^^void>^^null,
55
setDisplay: (domNode: HTMLElement, desiredValue: string) => {
66
if (domNode.style.display !== desiredValue) {
77
domNode.style.display = desiredValue;
@@ -14,7 +14,7 @@ function f(x: string | ((value: string) => number)) {
1414
return +x
1515
}
1616
else {
17-
let f = ^<^(^v: ^string) ^=> ^number^> ^x
17+
let f = ^^<^^(^^v: ^^string) ^^=> ^^number^^> ^^x
1818
return f("hello world")
1919
}
2020
}

0 commit comments

Comments
 (0)