Skip to content

Commit

Permalink
Add the expression scope to the keyword.operator to be colored as key…
Browse files Browse the repository at this point in the history
…word
  • Loading branch information
sheetalkamat committed Oct 18, 2016
1 parent fea3b25 commit b7a1912
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 67 deletions.
14 changes: 7 additions & 7 deletions TypeScript.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ repository:
- include: '#type'

type-predicate-operator:
name: keyword.operator.is.ts
name: keyword.operator.expression.is.ts
match: (?<!\.|\$)\bis\b(?!\$)

type-annotation:
Expand Down Expand Up @@ -1351,18 +1351,18 @@ repository:
patterns:
- name: keyword.control.flow.ts
match: (?<!\.|\$)\b(await)\b(?!\$)
- name: keyword.operator.delete.ts
- name: keyword.operator.expression.delete.ts
match: (?<!\.|\$)\bdelete\b(?!\$)
- name: keyword.operator.in.ts
- name: keyword.operator.expression.in.ts
match: (?<!\.|\$)\bin\b(?!\$)
- name: keyword.operator.of.ts
- name: keyword.operator.expression.of.ts
match: (?<!\.|\$)\bof\b(?!\$)
- name: keyword.operator.instanceof.ts
- name: keyword.operator.expression.instanceof.ts
match: (?<!\.|\$)\binstanceof\b(?!\$)
- name: keyword.operator.new.ts
match: (?<!\.|\$)\bnew\b(?!\$)
- include: '#typeof-operator'
- name: keyword.operator.void.ts
- name: keyword.operator.expression.void.ts
match: (?<!\.|\$)\bvoid\b(?!\$)
- begin: (?<!\.|\$)\bas\b(?!\$)
beginCaptures:
Expand Down Expand Up @@ -1396,7 +1396,7 @@ repository:
match: '%|\*|/|-|\+'

typeof-operator:
name: keyword.operator.typeof.ts
name: keyword.operator.expression.typeof.ts
match: (?<!\.|\$)\btypeof\b(?!\$)

arrow-function:
Expand Down
4 changes: 1 addition & 3 deletions TypeScript.YAML-tmTheme
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ name: TypeScript
uuid: ef98eb90-bf9b-11e4-bb52-0800200c9a66

settings:
- scope: storage.modifier, storage.type, keyword.control, keyword.other.ts, keyword.generator.asterisk, punctuation.definition.template-expression
settings: { vsclassificationtype: keyword }
- scope: keyword.operator.new.ts, keyword.operator.delete.ts, keyword.operator.in.ts, keyword.operator.of.ts, keyword.operator.instanceof.ts, keyword.operator.typeof.ts, keyword.operator.void.ts, keyword.control.as.ts, keyword.operator.is.ts
- scope: storage.modifier, storage.type, keyword.control, keyword.other.ts, keyword.operator.expression, keyword.operator.new, keyword.generator.asterisk, punctuation.definition.template-expression
settings: { vsclassificationtype: keyword }
- scope: support.type, constant.language, variable.language
settings: { vsclassificationtype: keyword }
Expand Down
14 changes: 7 additions & 7 deletions TypeScript.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -2289,7 +2289,7 @@
<key>type-predicate-operator</key>
<dict>
<key>name</key>
<string>keyword.operator.is.ts</string>
<string>keyword.operator.expression.is.ts</string>
<key>match</key>
<string>(?&lt;!\.|\$)\bis\b(?!\$)</string>
</dict>
Expand Down Expand Up @@ -3793,25 +3793,25 @@
</dict>
<dict>
<key>name</key>
<string>keyword.operator.delete.ts</string>
<string>keyword.operator.expression.delete.ts</string>
<key>match</key>
<string>(?&lt;!\.|\$)\bdelete\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.in.ts</string>
<string>keyword.operator.expression.in.ts</string>
<key>match</key>
<string>(?&lt;!\.|\$)\bin\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.of.ts</string>
<string>keyword.operator.expression.of.ts</string>
<key>match</key>
<string>(?&lt;!\.|\$)\bof\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.instanceof.ts</string>
<string>keyword.operator.expression.instanceof.ts</string>
<key>match</key>
<string>(?&lt;!\.|\$)\binstanceof\b(?!\$)</string>
</dict>
Expand All @@ -3827,7 +3827,7 @@
</dict>
<dict>
<key>name</key>
<string>keyword.operator.void.ts</string>
<string>keyword.operator.expression.void.ts</string>
<key>match</key>
<string>(?&lt;!\.|\$)\bvoid\b(?!\$)</string>
</dict>
Expand Down Expand Up @@ -3929,7 +3929,7 @@
<key>typeof-operator</key>
<dict>
<key>name</key>
<string>keyword.operator.typeof.ts</string>
<string>keyword.operator.expression.typeof.ts</string>
<key>match</key>
<string>(?&lt;!\.|\$)\btypeof\b(?!\$)</string>
</dict>
Expand Down
11 changes: 1 addition & 10 deletions TypeScript.tmTheme
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,7 @@
<array>
<dict>
<key>scope</key>
<string>storage.modifier, storage.type, keyword.control, keyword.other.ts, keyword.generator.asterisk, punctuation.definition.template-expression</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>keyword</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>keyword.operator.new.ts, keyword.operator.delete.ts, keyword.operator.in.ts, keyword.operator.of.ts, keyword.operator.instanceof.ts, keyword.operator.typeof.ts, keyword.operator.void.ts, keyword.control.as.ts, keyword.operator.is.ts</string>
<string>storage.modifier, storage.type, keyword.control, keyword.other.ts, keyword.operator.expression, keyword.operator.new, keyword.generator.asterisk, punctuation.definition.template-expression</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
Expand Down
14 changes: 7 additions & 7 deletions TypeScriptReact.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -2293,7 +2293,7 @@
<key>type-predicate-operator</key>
<dict>
<key>name</key>
<string>keyword.operator.is.tsx</string>
<string>keyword.operator.expression.is.tsx</string>
<key>match</key>
<string>(?&lt;!\.|\$)\bis\b(?!\$)</string>
</dict>
Expand Down Expand Up @@ -3775,25 +3775,25 @@
</dict>
<dict>
<key>name</key>
<string>keyword.operator.delete.tsx</string>
<string>keyword.operator.expression.delete.tsx</string>
<key>match</key>
<string>(?&lt;!\.|\$)\bdelete\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.in.tsx</string>
<string>keyword.operator.expression.in.tsx</string>
<key>match</key>
<string>(?&lt;!\.|\$)\bin\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.of.tsx</string>
<string>keyword.operator.expression.of.tsx</string>
<key>match</key>
<string>(?&lt;!\.|\$)\bof\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.instanceof.tsx</string>
<string>keyword.operator.expression.instanceof.tsx</string>
<key>match</key>
<string>(?&lt;!\.|\$)\binstanceof\b(?!\$)</string>
</dict>
Expand All @@ -3809,7 +3809,7 @@
</dict>
<dict>
<key>name</key>
<string>keyword.operator.void.tsx</string>
<string>keyword.operator.expression.void.tsx</string>
<key>match</key>
<string>(?&lt;!\.|\$)\bvoid\b(?!\$)</string>
</dict>
Expand Down Expand Up @@ -3911,7 +3911,7 @@
<key>typeof-operator</key>
<dict>
<key>name</key>
<string>keyword.operator.typeof.tsx</string>
<string>keyword.operator.expression.typeof.tsx</string>
<key>match</key>
<string>(?&lt;!\.|\$)\btypeof\b(?!\$)</string>
</dict>
Expand Down
11 changes: 1 addition & 10 deletions TypeScriptReact.tmTheme
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,7 @@
<array>
<dict>
<key>scope</key>
<string>storage.modifier, storage.type, keyword.control, keyword.other.tsx, keyword.generator.asterisk, punctuation.definition.template-expression</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
<string>keyword</string>
</dict>
</dict>
<dict>
<key>scope</key>
<string>keyword.operator.new.tsx, keyword.operator.delete.tsx, keyword.operator.in.tsx, keyword.operator.of.tsx, keyword.operator.instanceof.tsx, keyword.operator.typeof.tsx, keyword.operator.void.tsx, keyword.control.as.tsx, keyword.operator.is.tsx</string>
<string>storage.modifier, storage.type, keyword.control, keyword.other.tsx, keyword.operator.expression, keyword.operator.new, keyword.generator.asterisk, punctuation.definition.template-expression</string>
<key>settings</key>
<dict>
<key>vsclassificationtype</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ Grammar: TypeScript.tmLanguage
^
source.ts meta.function.ts meta.block.ts meta.brace.round.ts
^^^^^^
source.ts meta.function.ts meta.block.ts keyword.operator.typeof.ts
source.ts meta.function.ts meta.block.ts keyword.operator.expression.typeof.ts
^
source.ts meta.function.ts meta.block.ts
^
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/Issue180.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Grammar: TypeScript.tmLanguage
^
source.ts meta.brace.round.ts
^^^^^^
source.ts keyword.operator.typeof.ts
source.ts keyword.operator.expression.typeof.ts
^
source.ts
^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/Issue232.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Grammar: TypeScript.tmLanguage
^
source.ts
^^
source.ts keyword.operator.of.ts
source.ts keyword.operator.expression.of.ts
^
source.ts
^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/Issue243.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ Grammar: TypeScript.tmLanguage
^
source.ts
^^
source.ts keyword.operator.in.ts
source.ts keyword.operator.expression.in.ts
^
source.ts
^^^^^^
Expand Down
12 changes: 6 additions & 6 deletions tests/baselines/Issue37.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Grammar: TypeScript.tmLanguage
source.ts
>void newFunctionName(){
^^^^
source.ts keyword.operator.void.ts
source.ts keyword.operator.expression.void.ts
^
source.ts
^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -466,7 +466,7 @@ Grammar: TypeScript.tmLanguage
^
source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.type.annotation.ts
^^^^^^
source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.type.annotation.ts keyword.operator.typeof.ts
source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.type.annotation.ts keyword.operator.expression.typeof.ts
^
source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.type.annotation.ts
^
Expand Down Expand Up @@ -519,7 +519,7 @@ Grammar: TypeScript.tmLanguage
source.ts punctuation.terminator.statement.ts
>delete (adder)
^^^^^^
source.ts keyword.operator.delete.ts
source.ts keyword.operator.expression.delete.ts
^
source.ts
^
Expand All @@ -545,7 +545,7 @@ Grammar: TypeScript.tmLanguage
^
source.ts meta.var.expr.ts
^^^^^^
source.ts meta.var.expr.ts keyword.operator.typeof.ts
source.ts meta.var.expr.ts keyword.operator.expression.typeof.ts
^
source.ts meta.var.expr.ts
^
Expand Down Expand Up @@ -696,7 +696,7 @@ Grammar: TypeScript.tmLanguage
^
source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.brace.round.ts
^^^^^^
source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts keyword.operator.typeof.ts
source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts keyword.operator.expression.typeof.ts
^
source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts
^^^^^^
Expand Down Expand Up @@ -724,7 +724,7 @@ Grammar: TypeScript.tmLanguage
^
source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts
^^^^^^^^^^
source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts keyword.operator.instanceof.ts
source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts keyword.operator.expression.instanceof.ts
^
source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts
^^^^^
Expand Down
10 changes: 5 additions & 5 deletions tests/baselines/Issue37.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Grammar: TypeScript.tmLanguage
>
>void newFunctionName(){
^^^^
[19, 1]: source.ts keyword.operator.void.ts
[19, 1]: source.ts keyword.operator.expression.void.ts
^^^^^^^^^^^^^^^
[19, 6]: source.ts entity.name.function.ts
>
Expand Down Expand Up @@ -162,14 +162,14 @@ Grammar: TypeScript.tmLanguage
>
>var m: typeof M = M;
^^^^^^
[41, 8]: source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.type.annotation.ts keyword.operator.typeof.ts
[41, 8]: source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.type.annotation.ts keyword.operator.expression.typeof.ts
>
>var adder = new Adder(3, 4);
^^^
[43, 13]: source.ts meta.var.expr.ts new.expr.ts keyword.operator.new.ts
>delete (adder)
^^^^^^
[44, 1]: source.ts keyword.operator.delete.ts
[44, 1]: source.ts keyword.operator.expression.delete.ts
>
>var s = typeof {}git
>interface I {}
Expand Down Expand Up @@ -210,7 +210,7 @@ Grammar: TypeScript.tmLanguage
[56, 27]: source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts variable.other.readwrite.ts
> if (typeof parent === 'object' || parent instanceof Error) {
^^^^^^
[57, 17]: source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts keyword.operator.typeof.ts
[57, 17]: source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts keyword.operator.expression.typeof.ts
^^^^^^
[57, 24]: source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts variable.other.readwrite.ts
^^^
Expand All @@ -220,7 +220,7 @@ Grammar: TypeScript.tmLanguage
^^^^^^
[57, 47]: source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts variable.other.readwrite.ts
^^^^^^^^^^
[57, 54]: source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts keyword.operator.instanceof.ts
[57, 54]: source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts keyword.operator.expression.instanceof.ts
^^^^^
[57, 65]: source.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts support.class.error.ts
>
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/javascript.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Grammar: TypeScript.tmLanguage
source.ts
>typeof x;
^^^^^^
source.ts keyword.operator.typeof.ts
source.ts keyword.operator.expression.typeof.ts
^
source.ts
^
Expand All @@ -69,7 +69,7 @@ Grammar: TypeScript.tmLanguage
source.ts
>void x;
^^^^
source.ts keyword.operator.void.ts
source.ts keyword.operator.expression.void.ts
^
source.ts
^
Expand All @@ -80,7 +80,7 @@ Grammar: TypeScript.tmLanguage
source.ts
>delete x.y;
^^^^^^
source.ts keyword.operator.delete.ts
source.ts keyword.operator.expression.delete.ts
^
source.ts
^
Expand All @@ -99,7 +99,7 @@ Grammar: TypeScript.tmLanguage
^
source.ts
^^^^^^^^^^
source.ts keyword.operator.instanceof.ts
source.ts keyword.operator.expression.instanceof.ts
^
source.ts
^
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/javascript.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ Grammar: TypeScript.tmLanguage
>}
>typeof x;
^^^^^^
[5, 1]: source.ts keyword.operator.typeof.ts
[5, 1]: source.ts keyword.operator.expression.typeof.ts
>void x;
^^^^
[6, 1]: source.ts keyword.operator.void.ts
[6, 1]: source.ts keyword.operator.expression.void.ts
>delete x.y;
^^^^^^
[7, 1]: source.ts keyword.operator.delete.ts
[7, 1]: source.ts keyword.operator.expression.delete.ts
>x instanceof y;
^^^^^^^^^^
[8, 3]: source.ts keyword.operator.instanceof.ts
[8, 3]: source.ts keyword.operator.expression.instanceof.ts

0 comments on commit b7a1912

Please sign in to comment.