Skip to content

Commit

Permalink
Resolution mode support
Browse files Browse the repository at this point in the history
  • Loading branch information
sheetalkamat committed May 24, 2022
1 parent 1d5a44a commit 0dfae8c
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 6 deletions.
4 changes: 2 additions & 2 deletions TypeScript.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -2887,7 +2887,7 @@ repository:

directives:
name: comment.line.triple-slash.directive.ts
begin: ^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*({{quotedStrings}}))+\s*/>\s*$)
begin: ^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name|resolution-mode)\s*=\s*({{quotedStrings}}))+\s*/>\s*$)
beginCaptures:
'1': { name: punctuation.definition.comment.ts }
end: (?=$)
Expand All @@ -2902,7 +2902,7 @@ repository:
'0': { name: punctuation.definition.tag.directive.ts }
patterns:
- name: entity.other.attribute-name.directive.ts
match: 'path|types|no-default-lib|lib|name'
match: 'path|types|no-default-lib|lib|name|resolution-mode'
- name: keyword.operator.assignment.ts
match: '='
- include: '#string'
Expand Down
4 changes: 2 additions & 2 deletions TypeScript.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -8811,7 +8811,7 @@
<key>name</key>
<string>comment.line.triple-slash.directive.ts</string>
<key>begin</key>
<string>^(///)\s*(?=&lt;(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)))+\s*/&gt;\s*$)</string>
<string>^(///)\s*(?=&lt;(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name|resolution-mode)\s*=\s*((\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)))+\s*/&gt;\s*$)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
Expand Down Expand Up @@ -8858,7 +8858,7 @@
<key>name</key>
<string>entity.other.attribute-name.directive.ts</string>
<key>match</key>
<string>path|types|no-default-lib|lib|name</string>
<string>path|types|no-default-lib|lib|name|resolution-mode</string>
</dict>
<dict>
<key>name</key>
Expand Down
4 changes: 2 additions & 2 deletions TypeScriptReact.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -8759,7 +8759,7 @@
<key>name</key>
<string>comment.line.triple-slash.directive.tsx</string>
<key>begin</key>
<string>^(///)\s*(?=&lt;(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)))+\s*/&gt;\s*$)</string>
<string>^(///)\s*(?=&lt;(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name|resolution-mode)\s*=\s*((\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)))+\s*/&gt;\s*$)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
Expand Down Expand Up @@ -8806,7 +8806,7 @@
<key>name</key>
<string>entity.other.attribute-name.directive.tsx</string>
<key>match</key>
<string>path|types|no-default-lib|lib|name</string>
<string>path|types|no-default-lib|lib|name|resolution-mode</string>
</dict>
<dict>
<key>name</key>
Expand Down
90 changes: 90 additions & 0 deletions tests/baselines/resolutionMode.baseline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
original file
-----------------------------------
/// <reference types="pkg" resolution-mode="require" />
/// <reference types="pkg" resolution-mode="import" />


-----------------------------------

Grammar: TypeScript.tmLanguage
-----------------------------------
>/// <reference types="pkg" resolution-mode="require" />
^^^
source.ts comment.line.triple-slash.directive.ts punctuation.definition.comment.ts
^
source.ts comment.line.triple-slash.directive.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts punctuation.definition.tag.directive.ts
^^^^^^^^^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts entity.name.tag.directive.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts
^^^^^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts entity.other.attribute-name.directive.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts keyword.operator.assignment.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts punctuation.definition.string.begin.ts
^^^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts punctuation.definition.string.end.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts
^^^^^^^^^^^^^^^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts entity.other.attribute-name.directive.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts keyword.operator.assignment.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts punctuation.definition.string.begin.ts
^^^^^^^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts punctuation.definition.string.end.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts
^^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts punctuation.definition.tag.directive.ts
>/// <reference types="pkg" resolution-mode="import" />
^^^
source.ts comment.line.triple-slash.directive.ts punctuation.definition.comment.ts
^
source.ts comment.line.triple-slash.directive.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts punctuation.definition.tag.directive.ts
^^^^^^^^^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts entity.name.tag.directive.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts
^^^^^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts entity.other.attribute-name.directive.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts keyword.operator.assignment.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts punctuation.definition.string.begin.ts
^^^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts punctuation.definition.string.end.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts
^^^^^^^^^^^^^^^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts entity.other.attribute-name.directive.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts keyword.operator.assignment.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts punctuation.definition.string.begin.ts
^^^^^^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts string.quoted.double.ts punctuation.definition.string.end.ts
^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts
^^
source.ts comment.line.triple-slash.directive.ts meta.tag.ts punctuation.definition.tag.directive.ts
>
^
source.ts
>
^
source.ts
3 changes: 3 additions & 0 deletions tests/cases/resolutionMode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference types="pkg" resolution-mode="require" />
/// <reference types="pkg" resolution-mode="import" />

0 comments on commit 0dfae8c

Please sign in to comment.