From 230ba264bf78d9b4ecd42440f0cbb20529f9c235 Mon Sep 17 00:00:00 2001
From: Jake Langford <jake@twilsoft.uk>
Date: Wed, 6 Jul 2022 13:54:07 +0000
Subject: [PATCH] Introduce storage highlighting for typescript/javascript
 (#2961)

---
 book/src/themes.md                        |  4 +++-
 runtime/queries/javascript/highlights.scm | 19 +++++++++++++------
 runtime/queries/typescript/highlights.scm | 16 +++++++++++-----
 3 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/book/src/themes.md b/book/src/themes.md
index 06f920d3..ad8864b2 100644
--- a/book/src/themes.md
+++ b/book/src/themes.md
@@ -151,7 +151,9 @@ We use a similar set of scopes as
   - `operator` - `or`, `in`
   - `directive` - Preprocessor directives (`#if` in C) 
   - `function` - `fn`, `func`
-  - `storage` - Keywords that affect the storage of a variable, function or data structure `static`, `mut`, `const`, `ref`
+  - `storage` - Keywords describing how things are stored
+    - `type` - The type of something, `class`, `function`, `var`, `let`, etc. 
+    - `modifier` - Storage modifiers like `static`, `mut`, `const`, `ref`, etc.
 
 - `operator` - `||`, `+=`, `>`
 
diff --git a/runtime/queries/javascript/highlights.scm b/runtime/queries/javascript/highlights.scm
index 2616dffa..9a759081 100644
--- a/runtime/queries/javascript/highlights.scm
+++ b/runtime/queries/javascript/highlights.scm
@@ -163,19 +163,14 @@
 [
   "as"
   "async"
-  "class"
-  "const"
   "debugger"
   "delete"
-  "export"
   "extends"
   "from"
   "function"
   "get"
-  "import"
   "in"
   "instanceof"
-  "let"
   "new"
   "of"
   "set"
@@ -183,11 +178,17 @@
   "target"
   "try"
   "typeof"
-  "var"
   "void"
   "with"
 ] @keyword
 
+[
+  "class"
+  "let"
+  "const"
+  "var"
+] @keyword.storage.type
+
 [
   "switch"
   "case"
@@ -206,3 +207,9 @@
   "do"
   "await"
 ] @keyword.control
+
+[
+  "import"
+  "export"
+] @keyword.control.import 
+
diff --git a/runtime/queries/typescript/highlights.scm b/runtime/queries/typescript/highlights.scm
index a3212a3d..a424d100 100644
--- a/runtime/queries/typescript/highlights.scm
+++ b/runtime/queries/typescript/highlights.scm
@@ -22,15 +22,21 @@
 [
   "abstract"
   "declare"
-  "enum"
   "export"
   "implements"
-  "interface"
   "keyof"
   "namespace"
+] @keyword
+
+[
+  "type"
+  "interface"
+  "enum"
+] @keyword.storage.type
+
+[
+  "public"
   "private"
   "protected"
-  "public"
-  "type"
   "readonly"
-] @keyword
+] @keyword.storage.modifier
\ No newline at end of file