From f104492f0d41583139d7f5cc264891491acf0609 Mon Sep 17 00:00:00 2001 From: jakehl Date: Mon, 4 Jul 2022 16:19:16 +0100 Subject: [PATCH 1/3] adds (java|type)script storage highlight queries --- runtime/queries/javascript/highlights.scm | 19 +++++++++++++------ runtime/queries/typescript/highlights.scm | 16 +++++++++++----- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/runtime/queries/javascript/highlights.scm b/runtime/queries/javascript/highlights.scm index 2616dffa1dcf..9a759081a9b0 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 a3212a3dbcd7..a424d100f94f 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 From 98f48d2990ca6fea52a81df3ee55376d69024934 Mon Sep 17 00:00:00 2001 From: jakehl Date: Mon, 4 Jul 2022 18:07:03 +0100 Subject: [PATCH 2/3] adds documentation for the new scopes --- book/src/themes.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/book/src/themes.md b/book/src/themes.md index 06f920d3ccb5..085622e065fc 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 that affect the storage of variables, functions, data structures etc. + - `type` - Keywords for declaring the storage of variables, functions, data structures etc. eg `let`, `trait`, `struct` in rust + - `modifier` - Keywords that modify a declaration. eg `static`, `mut`, `const`, `ref` in rust - `operator` - `||`, `+=`, `>` From 3e7bb50671d59e18465e2fc45a546dfd3cf66ac8 Mon Sep 17 00:00:00 2001 From: jakehl Date: Wed, 6 Jul 2022 14:07:26 +0100 Subject: [PATCH 3/3] updates theme docs to better describe new keyword scopes --- book/src/themes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/src/themes.md b/book/src/themes.md index 085622e065fc..ad8864b20d57 100644 --- a/book/src/themes.md +++ b/book/src/themes.md @@ -151,9 +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 variables, functions, data structures etc. - - `type` - Keywords for declaring the storage of variables, functions, data structures etc. eg `let`, `trait`, `struct` in rust - - `modifier` - Keywords that modify a declaration. eg `static`, `mut`, `const`, `ref` in rust + - `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` - `||`, `+=`, `>`