diff options
author | Philipp Mildenberger | 2022-07-27 18:56:58 +0000 |
---|---|---|
committer | GitHub | 2022-07-27 18:56:58 +0000 |
commit | bf74a4652d97d7acb82e84467098e5b39f83827a (patch) | |
tree | 6422f2fac4a0a48f682685de907cccbb121bf6c6 /runtime/queries | |
parent | 85a5df03911be8f7845921a503ffb707bfc6bab4 (diff) |
JS/TS highlighting improvements (#3219)
Diffstat (limited to 'runtime/queries')
-rw-r--r-- | runtime/queries/javascript/highlights.scm | 5 | ||||
-rw-r--r-- | runtime/queries/typescript/highlights.scm | 44 |
2 files changed, 38 insertions, 11 deletions
diff --git a/runtime/queries/javascript/highlights.scm b/runtime/queries/javascript/highlights.scm index 9a759081..60336c3b 100644 --- a/runtime/queries/javascript/highlights.scm +++ b/runtime/queries/javascript/highlights.scm @@ -66,6 +66,8 @@ ;----------- (property_identifier) @variable.other.member +(shorthand_property_identifier) @variable.other.member +(shorthand_property_identifier_pattern) @variable.other.member ; Literals ;--------- @@ -149,8 +151,11 @@ "&&=" "||=" "??=" + "..." ] @operator +(ternary_expression ["?" ":"] @operator) + [ "(" ")" diff --git a/runtime/queries/typescript/highlights.scm b/runtime/queries/typescript/highlights.scm index a424d100..b89aa8c4 100644 --- a/runtime/queries/typescript/highlights.scm +++ b/runtime/queries/typescript/highlights.scm @@ -1,28 +1,36 @@ -; inherits: javascript - -; Types +; Namespaces -(type_identifier) @type -(predefined_type) @type.builtin +(internal_module + [((identifier) @namespace) ((nested_identifier (identifier) @namespace))]) -((identifier) @type - (#match? @type "^[A-Z]")) +(ambient_declaration "global" @namespace) -(type_arguments - "<" @punctuation.bracket - ">" @punctuation.bracket) ; Variables (required_parameter (identifier) @variable.parameter) (optional_parameter (identifier) @variable.parameter) +; Punctuation + +[ + ":" +] @punctuation.delimiter + +(optional_parameter "?" @punctuation.special) +(property_signature "?" @punctuation.special) + +(conditional_type ["?" ":"] @operator) + + + ; Keywords [ "abstract" "declare" "export" + "infer" "implements" "keyof" "namespace" @@ -39,4 +47,18 @@ "private" "protected" "readonly" -] @keyword.storage.modifier
\ No newline at end of file +] @keyword.storage.modifier + +; inherits: javascript + +; Types + +(type_identifier) @type +(predefined_type) @type.builtin + +(type_arguments + "<" @punctuation.bracket + ">" @punctuation.bracket) + +((identifier) @type + (#match? @type "^[A-Z]")) |