From 979285540f2143bd03086145ecf3c465a7b6985d Mon Sep 17 00:00:00 2001 From: Thom Smith Date: Fri, 4 Dec 2020 14:12:02 -0500 Subject: [PATCH] [JavaScript] [TypeScript] Use keyword.declaration for class, interface, and namespace. --- JavaScript/JavaScript.sublime-syntax | 2 +- JavaScript/TypeScript.sublime-syntax | 4 ++-- JavaScript/tests/syntax_test_js.js | 16 ++++++++-------- JavaScript/tests/syntax_test_typescript.ts | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/JavaScript/JavaScript.sublime-syntax b/JavaScript/JavaScript.sublime-syntax index d87e998445..e830e79aaf 100644 --- a/JavaScript/JavaScript.sublime-syntax +++ b/JavaScript/JavaScript.sublime-syntax @@ -1291,7 +1291,7 @@ contexts: class: - match: class{{identifier_break}} - scope: storage.type.class.js + scope: keyword.declaration.class.js set: - class-meta - class-body diff --git a/JavaScript/TypeScript.sublime-syntax b/JavaScript/TypeScript.sublime-syntax index 5d43a4101e..6cb51ed356 100644 --- a/JavaScript/TypeScript.sublime-syntax +++ b/JavaScript/TypeScript.sublime-syntax @@ -175,7 +175,7 @@ contexts: ts-interface-declaration: - match: interface{{identifier_break}} - scope: storage.type.js + scope: keyword.declaration.js set: - ts-interface-meta - ts-type-body @@ -319,7 +319,7 @@ contexts: ts-namespace-declaration: - match: namespace{{identifier_break}} - scope: storage.type.js + scope: keyword.declaration.js set: - ts-namespace-meta - block diff --git a/JavaScript/tests/syntax_test_js.js b/JavaScript/tests/syntax_test_js.js index d68ea64d78..919e848fc1 100644 --- a/JavaScript/tests/syntax_test_js.js +++ b/JavaScript/tests/syntax_test_js.js @@ -503,7 +503,7 @@ var obj = { // ^^^^^^^^ keyword.declaration.function objKey: new class Foo { -// ^^^^^ storage.type.class +// ^^^^^ keyword.declaration.class get baz() {} // ^^^ storage.type.accessor // ^^^ entity.name.function @@ -954,7 +954,7 @@ finally{}/**/ // ^ - meta.finally class MyClass extends TheirClass { -// <- storage.type.class +// <- keyword.declaration.class // ^^^^^^^ entity.name.class // ^^^^^^^ storage.modifier.extends // ^^^^^^^^^^ entity.other.inherited-class @@ -1211,12 +1211,12 @@ class Foo extends getSomeClass() {} // ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class // ^^^^^^^ storage.modifier.extends // ^^^^^^^^ meta.class meta.class -// ^^^^^ storage.type.class +// ^^^^^ keyword.declaration.class // Better highlighting while typing. class class -// <- storage.type.class - entity.name.class +// <- keyword.declaration.class - entity.name.class class{}/**/ // ^ - meta.class @@ -1235,20 +1235,20 @@ class{}/**/ // ^^^^ meta.annotation // ^ punctuation.definition.annotation // ^^^ variable.annotation -// ^^^^^ storage.type.class +// ^^^^^ keyword.declaration.class @foo.bar class Foo {} // ^^^^^^^^ meta.annotation // ^ punctuation.definition.annotation // ^^^ variable.other.readwrite - variable.annotation // ^^^ variable.annotation -// ^^^^^ storage.type.class +// ^^^^^ keyword.declaration.class @(whatever) class Foo {} // ^^^^^^^^^^^ meta.annotation // ^ punctuation.definition.annotation // ^^^^^^^^^^ meta.group -// ^^^^^ storage.type.class +// ^^^^^ keyword.declaration.class () => {}; // ^^^^^ meta.function @@ -1470,7 +1470,7 @@ var obj = new function() {}(); // ^^^^^^^^ keyword.declaration.function var obj2 = new class Foo{}(); -// ^^^^^ storage.type.class +// ^^^^^ keyword.declaration.class this.func() // <- variable.language.this diff --git a/JavaScript/tests/syntax_test_typescript.ts b/JavaScript/tests/syntax_test_typescript.ts index 2cf32ee755..61d82900ae 100644 --- a/JavaScript/tests/syntax_test_typescript.ts +++ b/JavaScript/tests/syntax_test_typescript.ts @@ -31,7 +31,7 @@ // ^^^^^^^^^^^^^^^^^^^^^^^ meta.export // ^^^^^^ keyword.control.import-export // ^^^^^^^^^^^^^^^^ meta.interface -// ^^^^^^^^^ storage.type +// ^^^^^^^^^ keyword.declaration // ^^^ entity.name.interface // ^^ meta.block @@ -39,7 +39,7 @@ // ^^^^^^^^^^^^^^^^^^^^^^^ meta.export // ^^^^^^ keyword.control.import-export // ^^^^^^^^^^^^^^^^ meta.namespace -// ^^^^^^^^^ storage.type +// ^^^^^^^^^ keyword.declaration // ^^^ entity.name.namespace // ^^ meta.block @@ -47,7 +47,7 @@ interface Foo { // ^^^^^^^^^^^^^^^^ meta.interface -// ^^^^^^^^^ storage.type +// ^^^^^^^^^ keyword.declaration // ^^^ entity.name.interface // ^ meta.block punctuation.section.block.begin foo: any; @@ -68,7 +68,7 @@ interface Foo < T > extends Bar < T > {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface -// ^^^^^^^^^ storage.type +// ^^^^^^^^^ keyword.declaration // ^^^ entity.name.interface // ^^^^^ meta.generic // ^ punctuation.definition.generic.begin @@ -237,7 +237,7 @@ namespace Foo { // ^^^^^^^^^^^^^^^^ meta.namespace -// ^^^^^^^^^ storage.type +// ^^^^^^^^^ keyword.declaration // ^^^ entity.name.namespace // ^ meta.block punctuation.section.block.begin }