Skip to content

Commit 40288b8

Browse files
authored
Merge pull request #620 from Microsoft/libReference
Add lib reference syntax
2 parents dd9d599 + b35f9e9 commit 40288b8

File tree

7 files changed

+88
-69
lines changed

7 files changed

+88
-69
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2369,7 +2369,7 @@ repository:
23692369

23702370
directives:
23712371
name: comment.line.triple-slash.directive.ts
2372-
begin: ^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|name)\s*=\s*({{quotedStrings}}))+\s*/>\s*$)
2372+
begin: ^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*({{quotedStrings}}))+\s*/>\s*$)
23732373
beginCaptures:
23742374
'1': { name: punctuation.definition.comment.ts }
23752375
end: (?=^)
@@ -2384,7 +2384,7 @@ repository:
23842384
'0': { name: punctuation.definition.tag.directive.ts }
23852385
patterns:
23862386
- name: entity.other.attribute-name.directive.ts
2387-
match: 'path|types|no-default-lib|name'
2387+
match: 'path|types|no-default-lib|lib|name'
23882388
- name: keyword.operator.assignment.ts
23892389
match: '='
23902390
- include: '#string'

TypeScript.tmLanguage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6946,7 +6946,7 @@
69466946
<key>name</key>
69476947
<string>comment.line.triple-slash.directive.ts</string>
69486948
<key>begin</key>
6949-
<string>^(///)\s*(?=&lt;(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|name)\s*=\s*((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")))+\s*/&gt;\s*$)</string>
6949+
<string>^(///)\s*(?=&lt;(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")))+\s*/&gt;\s*$)</string>
69506950
<key>beginCaptures</key>
69516951
<dict>
69526952
<key>1</key>
@@ -6993,7 +6993,7 @@
69936993
<key>name</key>
69946994
<string>entity.other.attribute-name.directive.ts</string>
69956995
<key>match</key>
6996-
<string>path|types|no-default-lib|name</string>
6996+
<string>path|types|no-default-lib|lib|name</string>
69976997
</dict>
69986998
<dict>
69996999
<key>name</key>

TypeScriptReact.tmLanguage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6892,7 +6892,7 @@
68926892
<key>name</key>
68936893
<string>comment.line.triple-slash.directive.tsx</string>
68946894
<key>begin</key>
6895-
<string>^(///)\s*(?=&lt;(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|name)\s*=\s*((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")))+\s*/&gt;\s*$)</string>
6895+
<string>^(///)\s*(?=&lt;(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")))+\s*/&gt;\s*$)</string>
68966896
<key>beginCaptures</key>
68976897
<dict>
68986898
<key>1</key>
@@ -6939,7 +6939,7 @@
69396939
<key>name</key>
69406940
<string>entity.other.attribute-name.directive.tsx</string>
69416941
<key>match</key>
6942-
<string>path|types|no-default-lib|name</string>
6942+
<string>path|types|no-default-lib|lib|name</string>
69436943
</dict>
69446944
<dict>
69456945
<key>name</key>

package-lock.json

Lines changed: 58 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"mocha": "latest",
2020
"plist": "latest",
2121
"typescript": "latest",
22-
"vscode-textmate": "latest",
22+
"vscode-textmate": "^3",
2323
"@types/chai": "latest",
2424
"@types/js-yaml": "latest",
2525
"@types/mocha": "latest",

tests/baselines/directives.baseline.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
original file
22
-----------------------------------
33
///<reference path="somePath.ts"/>
4+
///<reference lib="es2015"/>
45
///<amd-dependency path="somePath.ts"/>
56
///<amd-module name="modulename"/>
67
///<amd-dependency path="someOtherPath.ts" name="someOtherModule"/>
@@ -29,6 +30,27 @@ Grammar: TypeScript.tmLanguage
2930
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts punctuation.definition.string.end.ts
3031
^^
3132
source.ts comment.line.triple-slash.directive.ts meta.tag.ts punctuation.definition.tag.directive.ts
33+
>///<reference lib="es2015"/>
34+
^^^
35+
source.ts comment.line.triple-slash.directive.ts punctuation.definition.comment.ts
36+
^
37+
source.ts comment.line.triple-slash.directive.ts meta.tag.ts punctuation.definition.tag.directive.ts
38+
^^^^^^^^^
39+
source.ts comment.line.triple-slash.directive.ts meta.tag.ts entity.name.tag.directive.ts
40+
^
41+
source.ts comment.line.triple-slash.directive.ts meta.tag.ts
42+
^^^
43+
source.ts comment.line.triple-slash.directive.ts meta.tag.ts entity.other.attribute-name.directive.ts
44+
^
45+
source.ts comment.line.triple-slash.directive.ts meta.tag.ts keyword.operator.assignment.ts
46+
^
47+
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts punctuation.definition.string.begin.ts
48+
^^^^^^
49+
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts
50+
^
51+
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts punctuation.definition.string.end.ts
52+
^^
53+
source.ts comment.line.triple-slash.directive.ts meta.tag.ts punctuation.definition.tag.directive.ts
3254
>///<amd-dependency path="somePath.ts"/>
3355
^^^
3456
source.ts comment.line.triple-slash.directive.ts punctuation.definition.comment.ts

tests/cases/directives.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
///<reference path="somePath.ts"/>
2+
///<reference lib="es2015"/>
23
///<amd-dependency path="somePath.ts"/>
34
///<amd-module name="modulename"/>
45
///<amd-dependency path="someOtherPath.ts" name="someOtherModule"/>

0 commit comments

Comments
 (0)