blob: a5c8f01cc3b7c44c3fe54928fcdc1ef7f4331f48 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
; JavaScript highlights, from tree-sitter/tree-sitter-javascript v0.25.0
; queries/highlights.scm (MIT). Reordered for later-patterns-win and capture
; names mapped onto zed syntax keys. Upstream's @variable.builtin and require()
; patterns are gone: they lean on (#is-not? local), which no query engine
; outside nvim evaluates. Also loaded ahead of typescript.scm, the way upstream
; composes the TypeScript highlights.
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
[";" (optional_chain) "." ","] @punctuation.delimiter
["-" "--" "-=" "+" "++" "+=" "*" "*=" "**" "**=" "/" "/=" "%" "%=" "<" "<="
"<<" "<<=" "=" "==" "===" "!" "!=" "!==" "=>" ">" ">=" ">>" ">>=" ">>>"
">>>=" "~" "^" "&" "|" "^=" "&=" "|=" "&&" "||" "??" "&&=" "||="
"??="] @operator
["as" "async" "await" "break" "case" "catch" "class" "const" "continue"
"debugger" "default" "delete" "do" "else" "export" "extends" "finally" "for"
"from" "function" "get" "if" "import" "in" "instanceof" "let" "new" "of"
"return" "set" "static" "switch" "target" "throw" "try" "typeof" "var"
"void" "while" "with" "yield"] @keyword
[(property_identifier) (shorthand_property_identifier)] @property
((identifier) @constructor
(#match? @constructor "^[A-Z]"))
([(identifier) (shorthand_property_identifier)
(shorthand_property_identifier_pattern)] @constant
(#match? @constant "^[A-Z_][A-Z0-9_]+$"))
(function_expression name: (identifier) @function)
(function_declaration name: (identifier) @function)
(method_definition name: (property_identifier) @function.method)
(pair key: (property_identifier) @function.method
value: [(function_expression) (arrow_function)])
(assignment_expression
left: (member_expression property: (property_identifier) @function.method)
right: [(function_expression) (arrow_function)])
(variable_declarator name: (identifier) @function
value: [(function_expression) (arrow_function)])
(assignment_expression left: (identifier) @function
right: [(function_expression) (arrow_function)])
(call_expression function: (identifier) @function)
(call_expression function: (member_expression
property: (property_identifier) @function.method))
[(this) (super)] @variable.special
(number) @number
[(true) (false) (null) (undefined)] @constant
[(string) (template_string)] @string
(escape_sequence) @string.escape
(regex) @string.regex
(template_substitution "${" @punctuation.special "}" @punctuation.special)
(comment) @comment
|