on master help sign in
Introduce storage highlighting for typescript/javascript (#2961)
commit230ba264bf78d9b4ecd42440f0cbb20529f9c235 authorJake Langford <jake@twilsoft.uk> dateWed 6 Jul 2022, 13:54 (4 years ago) parente35abe3
3 files changed+27−12
book/src/themes.md+3−1 runtime/queries/javascript/highlights.scm+13−6 runtime/queries/typescript/highlights.scm+11−5
book/src/themes.md+3−1
@@ -151,7 +151,9 @@ We use a similar set of scopes as
151151 - `operator` - `or`, `in`
152152 - `directive` - Preprocessor directives (`#if` in C)
153153 - `function` - `fn`, `func`
154− - `storage` - Keywords that affect the storage of a variable, function or data structure `static`, `mut`, `const`, `ref`
154+ - `storage` - Keywords describing how things are stored
155+ - `type` - The type of something, `class`, `function`, `var`, `let`, etc.
156+ - `modifier` - Storage modifiers like `static`, `mut`, `const`, `ref`, etc.
155157
156158- `operator` - `||`, `+=`, `>`
157159
runtime/queries/javascript/highlights.scm+13−6
@@ -163,19 +163,14 @@
163163[
164164 "as"
165165 "async"
166− "class"
167− "const"
168166 "debugger"
169167 "delete"
170− "export"
171168 "extends"
172169 "from"
173170 "function"
174171 "get"
175− "import"
176172 "in"
177173 "instanceof"
178− "let"
179174 "new"
180175 "of"
181176 "set"
@@ -183,11 +178,17 @@
183178 "target"
184179 "try"
185180 "typeof"
186− "var"
187181 "void"
188182 "with"
189183] @keyword
190184
185+[
186+ "class"
187+ "let"
188+ "const"
189+ "var"
190+] @keyword.storage.type
191+
191192[
192193 "switch"
193194 "case"
@@ -206,3 +207,9 @@
206207 "do"
207208 "await"
208209] @keyword.control
210+
211+[
212+ "import"
213+ "export"
214+] @keyword.control.import
215+
runtime/queries/typescript/highlights.scm+11−5
@@ -22,15 +22,21 @@
2222[
2323 "abstract"
2424 "declare"
25− "enum"
2625 "export"
2726 "implements"
28− "interface"
2927 "keyof"
3028 "namespace"
29+] @keyword
30+
31+[
32+ "type"
33+ "interface"
34+ "enum"
35+] @keyword.storage.type
36+
37+[
38+ "public"
3139 "private"
3240 "protected"
33− "public"
34− "type"
3541 "readonly"
36−] @keyword
42+] @keyword.storage.modifier