Skip to content

Commit

Permalink
Add additional scope names to support some themes.
Browse files Browse the repository at this point in the history
Issue #405
  • Loading branch information
Graham Clark committed Aug 25, 2017
1 parent f9613fb commit e39cb98
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 44 deletions.
10 changes: 5 additions & 5 deletions grammars/Babel Language.json
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@
{
"match": "(?<!\\.)\\s*+\\b(delete|in|instanceof|new|of|typeof|void|with)\\b",
"captures": {
"1": { "name": "keyword.operator.js" }
"1": { "name": "keyword.operator.$1.js" }
}
},
{
Expand Down Expand Up @@ -1288,7 +1288,7 @@
"name": "meta.function-call.without-arguments.js",
"match": "(?<!\\.)\\s*+((\\bnew\\b)*)\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?:(\\?)(\\.))?(\\()\\s*+(\\))",
"captures": {
"2": { "name": "keyword.operator.js" },
"2": { "name": "keyword.operator.new.js" },
"3": { "name": "keyword.operator.private.js" },
"4": { "name": "entity.name.function.js" },
"5": { "name": "keyword.operator.existential.js"},
Expand All @@ -1304,7 +1304,7 @@
"end": "(?=.)",
"applyEndPatternLast": 1,
"beginCaptures": {
"2": { "name": "keyword.operator.js" },
"2": { "name": "keyword.operator.new.js" },
"3": { "name": "keyword.operator.private.js" },
"4": { "name": "variable.other.object.js" }
},
Expand All @@ -1319,7 +1319,7 @@
"end": "(?=.)",
"applyEndPatternLast": 1,
"beginCaptures": {
"2": { "name": "keyword.operator.js"},
"2": { "name": "keyword.operator.new.js"},
"3": { "name": "keyword.operator.private.js" },
"4": { "name": "entity.name.function.js"},
"5": { "name": "keyword.operator.existential.js"},
Expand All @@ -1336,7 +1336,7 @@
"end": "(?=.)",
"applyEndPatternLast": 1,
"beginCaptures": {
"2": { "name": "keyword.operator.js" },
"2": { "name": "keyword.operator.new.js" },
"3": { "name": "keyword.operator.private.js" },
"4": { "name": "variable.other.object.js" }
},
Expand Down
8 changes: 4 additions & 4 deletions spec/fixtures/grammar/babel-sublime/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ class CA {
// ^ support.type.class.flowtype
// ^ ^ meta.brace.curly.js
// ^^^^^^ keyword.control.flow.js
// ^^^ keyword.operator.js
// ^^^ keyword.operator.new.js
// ^^^ meta.function-call.without-arguments.js
// ^ entity.name.function.js
// ^ punctuation.terminator.statement.js
Expand Down Expand Up @@ -887,7 +887,7 @@ class D extends C<number> {
// ^ support.type.class.flowtype
// ^ ^ meta.brace.curly.js
// ^^^^^^ keyword.control.flow.js
// ^^^ keyword.operator.js
// ^^^ keyword.operator.new.js
// ^^^ meta.function-call.without-arguments.js
// ^ entity.name.function.js
// ^ punctuation.terminator.statement.js
Expand Down Expand Up @@ -915,7 +915,7 @@ var obj: {a: boolean; b: string; c: Foo} = {a: true, b: "Hi", c: new Foo()};
// ^^^^ string.quoted.double.js
// ^ punctuation.definition.string.begin.js
// ^ punctuation.definition.string.end.js
// ^^^ keyword.operator.js
// ^^^ keyword.operator.new.js
// ^^^^^ meta.function-call.without-arguments.js
// ^^^ entity.name.function.js
// ^^ meta.brace.round.js
Expand Down Expand Up @@ -1081,7 +1081,7 @@ var x: A | B | number | C = new C();
// ^ ^ ^ kewyword.operator.union.flowtype
// ^^^^^^ support.type.builtin.primitive.flowtype
// ^ keyword.operator.assignment.js
// ^^^ keyword.operator.js
// ^^^ keyword.operator.new.js
// ^^^ meta.function-call.without-arguments.js
// ^ entity.name.function.js
// ^^ meta.brace.round.js
Expand Down
46 changes: 24 additions & 22 deletions spec/fixtures/grammar/everythingJs/es2015-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -857,17 +857,17 @@ x = function f(){ return f; }; x[0] = x; x.a = x;
// ^ variable.other.property.js

new x(); new new x()();
// <- keyword.operator.js
// <- keyword.operator.js
//^ ^^^ ^^^ keyword.operator.js
// <- keyword.operator.new.js
// <- keyword.operator.new.js
//^ ^^^ ^^^ keyword.operator.new.js
// ^^^ ^^^ meta.function-call.without-arguments.js
// ^ ^ entity.name.function.js
// ^^ ^^^^ meta.brace.round.js
// ^ ^ punctuation.terminator.statement.js
new x[0](); new x.a(); new x[0].a(); new x.a[0]();
// <- keyword.operator.js
// <- keyword.operator.js
//^ ^^^ ^^^ ^^^ keyword.operator.js
// <- keyword.operator.new.js
// <- keyword.operator.new.js
//^ ^^^ ^^^ ^^^ keyword.operator.new.js
// ^^^^^^ meta.function-call.without-arguments.js
// ^ ^ ^ ^ variable.other.object.js
// ^ ^ ^ ^ ^ ^ meta.brace.square.js
Expand All @@ -878,18 +878,18 @@ new x[0](); new x.a(); new x[0].a(); new x.a[0]();
// ^^^ ^^^ ^^^^^^ meta.method-call.without-arguments.js
// ^ ^ ^ entity.name.function.js
new x; new new x; new new x();
// <- keyword.operator.js
// <- keyword.operator.js
//^ ^^^ ^^^ ^^^ ^^^ keyword.operator.js
// <- keyword.operator.new.js
// <- keyword.operator.new.js
//^ ^^^ ^^^ ^^^ ^^^ keyword.operator.new.js
// ^ ^ variable.other.readwrite.js
// ^ ^ ^ punctuation.terminator.statement.js
// ^^^ meta.function-call.without-arguments.js
// ^ entity.name.function.js
// ^^ meta.brace.round.js
new new x().a; new new x()[0];
// <- keyword.operator.js
// <- keyword.operator.js
//^ ^^^ ^^^ ^^^ keyword.operator.js
// <- keyword.operator.new.js
// <- keyword.operator.new.js
//^ ^^^ ^^^ ^^^ keyword.operator.new.js
// ^^^ ^^^ meta.function-call.without-arguments.js
// ^ ^ entity.name.function.js
// ^^ ^^ meta.brace.round.js
Expand Down Expand Up @@ -962,9 +962,11 @@ x++; x--;
// ^ ^ punctuation.terminator.statement.js

delete void typeof+-~!x; ++x; --x;
// <- keyword.operator.js
// <- keyword.operator.js
//^^^^ ^^^^ ^^^^^^ keyword.operator.js
// <- keyword.operator.delete.js
// <- keyword.operator.delete.js
//^^^^ keyword.operator.delete.js
// ^^^^ keyword.operator.void.js
// ^^^^^^ keyword.operator.typeof.js
// ^^ ^^ ^^ keyword.operator.arithmetic.js
// ^ keyword.operator.bitwise.js
// ^ keyword.operator.logical.js
Expand Down Expand Up @@ -1000,7 +1002,7 @@ delete void typeof+-~!x; ++x; --x;
// ^ ^ ^ ^ punctuation.terminator.statement.js
0 instanceof function(){};
// <- constant.numeric.js
//^^^^^^^^^^ keyword.operator.js
//^^^^^^^^^^ keyword.operator.instanceof.js
// ^^^^^^^^^^^^ meta.function.js
// ^^^^^^^^ storage.type.function.js
// ^ punctuation.definition.parameters.begin.js
Expand All @@ -1010,7 +1012,7 @@ delete void typeof+-~!x; ++x; --x;
// ^ punctuation.terminator.statement.js
0 in{};
// <- constant.numeric.js
//^^ keyword.operator.js
//^^ keyword.operator.in.js
// ^^ meta.brace.curly.js
// ^ punctuation.terminator.statement.js

Expand Down Expand Up @@ -1133,7 +1135,7 @@ for(;;)break; for(0;0;0); for((0 in[]);0;);
// ^ ^ ^ ^ ^^ ^ ^ meta.brace.round.js
// ^^ ^ ^ ^ ^ ^ ^ ^ punctuation.terminator.statement.js
// ^ ^ ^ ^ ^ constant.numeric.js
// ^^ keyword.operator.js
// ^^ keyword.operator.in.js
// ^^ meta.brace.square.js
for(var a0;;)break; for(var a1,b2;0;0);
// <- meta.for.js keyword.control.loop.js
Expand All @@ -1156,7 +1158,7 @@ for(var a3=0;;)break; for(var a4=(0 in[]);0;);
// ^ ^ keyword.operator.assignment.js
// ^ ^ ^ constant.numeric.js
// ^^ ^ ^ ^ ^ punctuation.terminator.statement.js
// ^^ keyword.operator.js
// ^^ keyword.operator.in.js
// ^^ meta.brace.square.js
for(x in{}); for(var x12 in{});
// <- meta.for.js keyword.control.loop.js
Expand All @@ -1165,7 +1167,7 @@ for(x in{}); for(var x12 in{});
//^ ^^^ keyword.control.loop.js
// ^ ^ ^ ^ meta.brace.round.js
// ^ ^^^ variable.other.readwrite.js
// ^^ ^^ keyword.operator.js
// ^^ ^^ keyword.operator.in.js
// ^^ ^^ meta.brace.curly.js
// ^ ^ punctuation.terminator.statement.js
// ^^^ storage.type.js
Expand All @@ -1176,7 +1178,7 @@ for(x of[]); for(var x13 of[]);
//^ ^^^ keyword.control.loop.js
// ^ ^ ^ ^ meta.brace.round.js
// ^ ^^^ variable.other.readwrite.js
// ^^ ^^ keyword.operator.js
// ^^ ^^ keyword.operator.of.js
// ^^ ^^ meta.brace.square.js
// ^ ^ punctuation.terminator.statement.js
// ^^^ storage.type.js
Expand Down Expand Up @@ -1898,7 +1900,7 @@ class B extends new A {
// ^^^^^^^^^^^^^^^^^ meta.function-call.with-arguments.js
// ^^^^^ entity.name.function.js
// ^ ^ meta.brace.round.js
// ^^^ keyword.operator.js
// ^^^ keyword.operator.new.js
// ^ keyword.operator.accessor.js
// ^^^^^^ meta.property.object.js
// ^^^^^^ variable.other.property.js
Expand Down
26 changes: 13 additions & 13 deletions spec/fixtures/grammar/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ for (const x:a<T> of a) {}
// ^ support.type.primitive.flowtype
// ^ ^ punctuation.flowtype
// ^ support.type.class.flowtype
// ^^ keyword.operator.js
// ^^ keyword.operator.of.js
// ^^ meta.brace.curly.js
for (const x:a<T> in a) {}
// <- meta.for.js keyword.control.loop.js
Expand All @@ -27,7 +27,7 @@ for (const x:a<T> in a) {}
// ^ support.type.primitive.flowtype
// ^ ^ punctuation.flowtype
// ^ support.type.class.flowtype
// ^^ keyword.operator.js
// ^^ keyword.operator.in.js
// ^^ meta.brace.curly.js
// Issue #397
let result = "hello"
Expand Down Expand Up @@ -479,20 +479,20 @@ if (foo instanceof (Date)) return;
// <- keyword.control.conditional.js
// ^ ^ ^^ meta.brace.round.js
// ^^^ variable.other.readwrite.js
// ^^^^^^^^^^ keyword.operator.js
// ^^^^^^^^^^ keyword.operator.instanceof.js
// ^^^^ support.class.builtin.js
// ^^^^^^ keyword.control.flow.js
// ^ punctuation.terminator.statement.js
delete(x)
// <- keyword.operator.js
// <- keyword.operator.js
//^^^^ keyword.operator.js
// <- keyword.operator.delete.js
// <- keyword.operator.delete.js
//^^^^ keyword.operator.delete.js
// ^ ^ meta.brace.round.js
// ^ variable.other.readwrite.js
void (0)
// <- keyword.operator.js
// <- keyword.operator.js
//^^ keyword.operator.js
// <- keyword.operator.void.js
// <- keyword.operator.void.js
//^^ keyword.operator.void.js
// ^ ^ meta.brace.round.js
// ^ constant.numeric.js
function test() {
Expand All @@ -510,18 +510,18 @@ function test() {
//^^ keyword.control.conditional.js
// ^ ^ ^^ meta.brace.round.js
// ^^^ variable.other.readwrite.js
// ^^^^^^^^^^ keyword.operator.js
// ^^^^^^^^^^ keyword.operator.instanceof.js
// ^^^^ support.class.builtin.js
// ^^^^^^ keyword.control.flow.js
// ^ punctuation.terminator.statement.js
delete(x)
//^^^^^^^^^ meta.function.js
//^^^^^^ keyword.operator.js
//^^^^^^ keyword.operator.delete.js
// ^ ^ meta.brace.round.js
// ^ variable.other.readwrite.js
void (0)
//^^^^ ^^^ meta.function.js
//^^^^ keyword.operator.js
//^^^^ keyword.operator.void.js
// ^ ^ meta.brace.round.js
// ^ constant.numeric.js
}
Expand Down Expand Up @@ -985,7 +985,7 @@ function a(state ) {
// ^ ^ meta.brace.round.js
// ^^^ storage.type.js
// ^^^^ ^^^^^^^ variable.other.readwrite.js
// ^^ keyword.operator.js
// ^^ keyword.operator.in.js
state.items = setItem( state.items, resolveRelations({ ...item }) )
// ^^^^^^^^^^^ ^ ^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^ ^^ ^ meta.function.js
// ^^^^^^^^^^^ ^ ^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^ ^^ ^ meta.switch.js
Expand Down

0 comments on commit e39cb98

Please sign in to comment.