on master help sign in
JS/TS highlighting improvements (#3219)
commitbf74a4652d97d7acb82e84467098e5b39f83827a authorPhilipp Mildenberger <philipp@mildenberger.me> dateWed 27 Jul 2022, 20:56 (4 years ago) parent85a5df0
2 files changed+38−11
runtime/queries/javascript/highlights.scm+5 runtime/queries/typescript/highlights.scm+33−11
runtime/queries/javascript/highlights.scm+5
@@ -66,6 +66,8 @@
6666;-----------
6767
6868(property_identifier) @variable.other.member
69+(shorthand_property_identifier) @variable.other.member
70+(shorthand_property_identifier_pattern) @variable.other.member
6971
7072; Literals
7173;---------
@@ -149,8 +151,11 @@
149151 "&&="
150152 "||="
151153 "??="
154+ "..."
152155] @operator
153156
157+(ternary_expression ["?" ":"] @operator)
158+
154159[
155160 "("
156161 ")"
runtime/queries/typescript/highlights.scm+33−11
@@ -1,28 +1,36 @@
1−; inherits: javascript
2−
3−; Types
1+; Namespaces
42
5−(type_identifier) @type
6−(predefined_type) @type.builtin
3+(internal_module
4+ [((identifier) @namespace) ((nested_identifier (identifier) @namespace))])
75
8−((identifier) @type
9− (#match? @type "^[A-Z]"))
6+(ambient_declaration "global" @namespace)
107
11−(type_arguments
12− "<" @punctuation.bracket
13− ">" @punctuation.bracket)
148
159; Variables
1610
1711(required_parameter (identifier) @variable.parameter)
1812(optional_parameter (identifier) @variable.parameter)
1913
14+; Punctuation
15+
16+[
17+ ":"
18+] @punctuation.delimiter
19+
20+(optional_parameter "?" @punctuation.special)
21+(property_signature "?" @punctuation.special)
22+
23+(conditional_type ["?" ":"] @operator)
24+
25+
26+
2027; Keywords
2128
2229[
2330 "abstract"
2431 "declare"
2532 "export"
33+ "infer"
2634 "implements"
2735 "keyof"
2836 "namespace"
@@ -39,4 +47,18 @@
3947 "private"
4048 "protected"
4149 "readonly"
42−] @keyword.storage.modifier
50+] @keyword.storage.modifier
51+
52+; inherits: javascript
53+
54+; Types
55+
56+(type_identifier) @type
57+(predefined_type) @type.builtin
58+
59+(type_arguments
60+ "<" @punctuation.bracket
61+ ">" @punctuation.bracket)
62+
63+((identifier) @type
64+ (#match? @type "^[A-Z]"))