From 987b140efa116497e5814919f7a8d0ea71686715 Mon Sep 17 00:00:00 2001 From: Andrew Currier Date: Mon, 26 Jan 2026 09:16:51 -0500 Subject: [PATCH] Improve TypeScript keyword syntax highlighting (#47435) Improve syntax highlighting of keywords by creating groups for declarations and import/export. ### Release Notes: - Highlight declarations with `keyword.declaration`: - const - let - var - function - class - enum - interface - type - Highlight imports and exports with `keyword.import`: - export - from - import --------- Co-authored-by: Gaauwe Rombouts --- .../languages/src/javascript/highlights.scm | 22 +++++++---- crates/languages/src/tsx/highlights.scm | 37 +++++++++++++++---- .../languages/src/typescript/highlights.scm | 28 ++++++++------ 3 files changed, 60 insertions(+), 27 deletions(-) diff --git a/crates/languages/src/javascript/highlights.scm b/crates/languages/src/javascript/highlights.scm index 3194b256a944fcc0198a3cb948aa273431cc9f11..1a29f0134cf0063a171a6dfae1974beec2bfb779 100644 --- a/crates/languages/src/javascript/highlights.scm +++ b/crates/languages/src/javascript/highlights.scm @@ -246,20 +246,13 @@ "as" "async" "await" - "class" - "const" "debugger" "default" "delete" - "export" "extends" - "from" - "function" "get" - "import" "in" "instanceof" - "let" "new" "of" "set" @@ -267,11 +260,24 @@ "target" "typeof" "using" - "var" "void" "with" ] @keyword +[ + "const" + "let" + "var" + "function" + "class" +] @keyword.declaration + +[ + "export" + "from" + "import" +] @keyword.import + [ "break" "case" diff --git a/crates/languages/src/tsx/highlights.scm b/crates/languages/src/tsx/highlights.scm index a9cac693cead73cb04d7f1f8e15fa64df81d1da6..0f14438b94a4fa506e3c21e2cc4177687d7c30f6 100644 --- a/crates/languages/src/tsx/highlights.scm +++ b/crates/languages/src/tsx/highlights.scm @@ -263,37 +263,58 @@ ) [ + "abstract" "as" "async" "await" - "class" - "const" "debugger" + "declare" "default" "delete" - "export" "extends" - "from" - "function" "get" - "import" + "implements" "in" + "infer" "instanceof" "is" - "let" + "keyof" + "module" + "namespace" "new" "of" + "override" + "private" + "protected" + "public" + "readonly" "satisfies" "set" "static" "target" "typeof" "using" - "var" "void" "with" ] @keyword +[ + "const" + "let" + "var" + "function" + "class" + "enum" + "interface" + "type" +] @keyword.declaration + +[ + "export" + "from" + "import" +] @keyword.import + [ "break" "case" diff --git a/crates/languages/src/typescript/highlights.scm b/crates/languages/src/typescript/highlights.scm index 2e26e25bf793a138ee7751c4802cb30d202690ea..e38467626fe475aa21bd7a62e8735dbd55320bfe 100644 --- a/crates/languages/src/typescript/highlights.scm +++ b/crates/languages/src/typescript/highlights.scm @@ -383,27 +383,18 @@ "as" "async" "await" - "class" - "const" "debugger" "declare" "default" "delete" - "enum" - "export" "extends" - "from" - "function" "get" "implements" - "import" "in" "infer" "instanceof" - "interface" "is" "keyof" - "let" "module" "namespace" "new" @@ -417,14 +408,29 @@ "set" "static" "target" - "type" "typeof" "using" - "var" "void" "with" ] @keyword +[ + "const" + "let" + "var" + "function" + "class" + "enum" + "interface" + "type" +] @keyword.declaration + +[ + "export" + "from" + "import" +] @keyword.import + [ "break" "case"