2020-10-06 20:03:39 +02:00
|
|
|
; inherits: (jsx)
|
2020-06-12 07:41:20 -05:00
|
|
|
; Types
|
|
|
|
|
|
|
|
|
|
; Javascript
|
2020-08-15 09:24:24 -05:00
|
|
|
|
2020-09-12 20:57:01 +02:00
|
|
|
; Variables
|
|
|
|
|
;-----------
|
|
|
|
|
(identifier) @variable
|
|
|
|
|
|
2020-08-15 09:24:24 -05:00
|
|
|
; Properties
|
|
|
|
|
;-----------
|
|
|
|
|
|
|
|
|
|
(property_identifier) @property
|
2020-11-26 13:21:05 -05:00
|
|
|
(shorthand_property_identifier) @variable
|
2020-08-15 09:24:24 -05:00
|
|
|
|
2020-06-12 07:41:20 -05:00
|
|
|
; Special identifiers
|
|
|
|
|
;--------------------
|
|
|
|
|
|
2020-08-15 09:24:24 -05:00
|
|
|
(identifier) @variable
|
|
|
|
|
|
2020-10-23 22:05:27 +03:00
|
|
|
((identifier) @constructor
|
|
|
|
|
(#match? @constructor "^[A-Z]"))
|
|
|
|
|
|
2020-06-12 07:41:20 -05:00
|
|
|
((identifier) @constant
|
2020-08-16 11:24:10 -05:00
|
|
|
(#vim-match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
2020-06-12 07:41:20 -05:00
|
|
|
|
|
|
|
|
((shorthand_property_identifier) @constant
|
2020-08-16 11:24:10 -05:00
|
|
|
(#vim-match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
2020-06-12 07:41:20 -05:00
|
|
|
|
|
|
|
|
((identifier) @variable.builtin
|
2020-08-16 11:24:10 -05:00
|
|
|
(#vim-match? @variable.builtin "^(arguments|module|console|window|document)$"))
|
2020-06-12 07:41:20 -05:00
|
|
|
|
|
|
|
|
((identifier) @function.builtin
|
|
|
|
|
(#eq? @function.builtin "require"))
|
|
|
|
|
|
|
|
|
|
; Function and method definitions
|
|
|
|
|
;--------------------------------
|
|
|
|
|
|
|
|
|
|
(function
|
|
|
|
|
name: (identifier) @function)
|
|
|
|
|
(function_declaration
|
|
|
|
|
name: (identifier) @function)
|
|
|
|
|
(method_definition
|
2020-08-17 19:30:04 -07:00
|
|
|
name: (property_identifier) @method)
|
2020-06-12 07:41:20 -05:00
|
|
|
|
|
|
|
|
(pair
|
2020-08-17 19:30:04 -07:00
|
|
|
key: (property_identifier) @method
|
2020-06-12 07:41:20 -05:00
|
|
|
value: (function))
|
|
|
|
|
(pair
|
2020-08-17 19:30:04 -07:00
|
|
|
key: (property_identifier) @method
|
2020-06-12 07:41:20 -05:00
|
|
|
value: (arrow_function))
|
|
|
|
|
|
|
|
|
|
(assignment_expression
|
|
|
|
|
left: (member_expression
|
2020-08-17 19:30:04 -07:00
|
|
|
property: (property_identifier) @method)
|
2020-06-12 07:41:20 -05:00
|
|
|
right: (arrow_function))
|
|
|
|
|
(assignment_expression
|
|
|
|
|
left: (member_expression
|
2020-08-17 19:30:04 -07:00
|
|
|
property: (property_identifier) @method)
|
2020-06-12 07:41:20 -05:00
|
|
|
right: (function))
|
|
|
|
|
|
|
|
|
|
(variable_declarator
|
|
|
|
|
name: (identifier) @function
|
|
|
|
|
value: (arrow_function))
|
|
|
|
|
(variable_declarator
|
|
|
|
|
name: (identifier) @function
|
|
|
|
|
value: (function))
|
|
|
|
|
|
|
|
|
|
(assignment_expression
|
|
|
|
|
left: (identifier) @function
|
|
|
|
|
right: (arrow_function))
|
|
|
|
|
(assignment_expression
|
|
|
|
|
left: (identifier) @function
|
|
|
|
|
right: (function))
|
|
|
|
|
|
|
|
|
|
; Function and method calls
|
|
|
|
|
;--------------------------
|
|
|
|
|
|
|
|
|
|
(call_expression
|
|
|
|
|
function: (identifier) @function)
|
|
|
|
|
|
|
|
|
|
(call_expression
|
|
|
|
|
function: (member_expression
|
2020-08-17 19:30:04 -07:00
|
|
|
property: (property_identifier) @method))
|
2020-06-12 07:41:20 -05:00
|
|
|
|
|
|
|
|
; Variables
|
|
|
|
|
;----------
|
|
|
|
|
|
2020-07-21 10:48:25 -05:00
|
|
|
(formal_parameters (identifier) @parameter)
|
|
|
|
|
|
|
|
|
|
(formal_parameters
|
|
|
|
|
(rest_parameter
|
|
|
|
|
(identifier) @parameter))
|
2020-06-12 07:41:20 -05:00
|
|
|
|
2020-10-27 08:34:45 +03:00
|
|
|
; ({ a }) => null
|
|
|
|
|
(formal_parameters
|
|
|
|
|
(object_pattern
|
|
|
|
|
(shorthand_property_identifier) @parameter))
|
|
|
|
|
|
|
|
|
|
; ({ a: b }) => null
|
|
|
|
|
(formal_parameters
|
|
|
|
|
(object_pattern
|
|
|
|
|
(pair
|
|
|
|
|
value: (identifier) @parameter)))
|
|
|
|
|
|
|
|
|
|
; ([ a ]) => null
|
|
|
|
|
(formal_parameters
|
|
|
|
|
(array_pattern
|
|
|
|
|
(identifier) @parameter))
|
|
|
|
|
|
2020-10-27 08:37:09 +03:00
|
|
|
; a => null
|
2020-10-15 21:34:52 +03:00
|
|
|
(variable_declarator
|
|
|
|
|
value: (arrow_function
|
|
|
|
|
parameter: (identifier) @parameter))
|
|
|
|
|
|
2020-11-05 00:43:50 +01:00
|
|
|
; optional parameters
|
|
|
|
|
(formal_parameters
|
|
|
|
|
(assignment_pattern
|
|
|
|
|
(shorthand_property_identifier) @parameter))
|
|
|
|
|
|
2020-09-22 23:01:19 +02:00
|
|
|
; Variables
|
|
|
|
|
;----------
|
|
|
|
|
(namespace_import
|
|
|
|
|
(identifier) @namespace)
|
|
|
|
|
|
2020-06-12 07:41:20 -05:00
|
|
|
; Literals
|
|
|
|
|
;---------
|
|
|
|
|
|
|
|
|
|
(this) @variable.builtin
|
|
|
|
|
(super) @variable.builtin
|
|
|
|
|
|
2020-06-15 15:11:07 -05:00
|
|
|
(true) @boolean
|
|
|
|
|
(false) @boolean
|
2020-06-12 07:41:20 -05:00
|
|
|
(null) @constant.builtin
|
|
|
|
|
(comment) @comment
|
|
|
|
|
(string) @string
|
2020-08-17 00:21:34 +02:00
|
|
|
(regex) @punctuation.delimiter
|
|
|
|
|
(regex_pattern) @string.regex
|
2020-06-12 07:41:20 -05:00
|
|
|
(template_string) @string
|
|
|
|
|
(number) @number
|
|
|
|
|
|
|
|
|
|
; Punctuation
|
|
|
|
|
;------------
|
|
|
|
|
|
|
|
|
|
(template_substitution
|
|
|
|
|
"${" @punctuation.special
|
|
|
|
|
"}" @punctuation.special) @embedded
|
2020-11-21 11:48:58 -05:00
|
|
|
|
2020-11-05 16:46:03 +01:00
|
|
|
"..." @punctuation.special
|
2020-06-12 07:41:20 -05:00
|
|
|
|
|
|
|
|
";" @punctuation.delimiter
|
|
|
|
|
"." @punctuation.delimiter
|
|
|
|
|
"," @punctuation.delimiter
|
2020-12-20 21:49:41 +09:00
|
|
|
"?." @punctuation.delimiter
|
2020-06-12 07:41:20 -05:00
|
|
|
|
2020-11-23 12:07:31 -05:00
|
|
|
(pair ":" @punctuation.delimiter)
|
|
|
|
|
|
2020-09-08 07:52:46 -05:00
|
|
|
[
|
|
|
|
|
"--"
|
|
|
|
|
"-"
|
|
|
|
|
"-="
|
|
|
|
|
"&&"
|
|
|
|
|
"+"
|
|
|
|
|
"++"
|
|
|
|
|
"+="
|
|
|
|
|
"&="
|
|
|
|
|
"/="
|
|
|
|
|
"**="
|
|
|
|
|
"<<="
|
|
|
|
|
"<"
|
|
|
|
|
"<="
|
|
|
|
|
"<<"
|
|
|
|
|
"="
|
|
|
|
|
"=="
|
|
|
|
|
"==="
|
|
|
|
|
"!="
|
|
|
|
|
"!=="
|
|
|
|
|
"=>"
|
|
|
|
|
">"
|
|
|
|
|
">="
|
|
|
|
|
">>"
|
|
|
|
|
"||"
|
|
|
|
|
"%"
|
|
|
|
|
"%="
|
2020-12-20 21:49:41 +09:00
|
|
|
"*"
|
|
|
|
|
"**"
|
|
|
|
|
">>>"
|
|
|
|
|
"&"
|
|
|
|
|
"|"
|
|
|
|
|
"^"
|
|
|
|
|
"??"
|
|
|
|
|
"*="
|
|
|
|
|
">>="
|
|
|
|
|
">>>="
|
|
|
|
|
"^="
|
|
|
|
|
"|="
|
|
|
|
|
"&&="
|
|
|
|
|
"||="
|
|
|
|
|
"??="
|
2020-09-08 07:52:46 -05:00
|
|
|
] @operator
|
|
|
|
|
|
2020-11-25 15:37:18 -05:00
|
|
|
(binary_expression "/" @operator)
|
2020-09-08 07:52:46 -05:00
|
|
|
(ternary_expression ["?" ":"] @operator)
|
2020-12-12 15:47:09 -05:00
|
|
|
(unary_expression ["!" "~" "-" "+" "delete" "void" "typeof"] @operator)
|
2020-06-12 07:41:20 -05:00
|
|
|
|
|
|
|
|
"(" @punctuation.bracket
|
|
|
|
|
")" @punctuation.bracket
|
|
|
|
|
"[" @punctuation.bracket
|
|
|
|
|
"]" @punctuation.bracket
|
|
|
|
|
"{" @punctuation.bracket
|
|
|
|
|
"}" @punctuation.bracket
|
|
|
|
|
|
|
|
|
|
; Keywords
|
|
|
|
|
;----------
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"if"
|
|
|
|
|
"else"
|
|
|
|
|
"switch"
|
|
|
|
|
"case"
|
|
|
|
|
"default"
|
|
|
|
|
] @conditional
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"import"
|
|
|
|
|
"from"
|
|
|
|
|
"as"
|
|
|
|
|
] @include
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"for"
|
|
|
|
|
"of"
|
|
|
|
|
"do"
|
|
|
|
|
"while"
|
|
|
|
|
"continue"
|
|
|
|
|
] @repeat
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"async"
|
|
|
|
|
"await"
|
|
|
|
|
"break"
|
|
|
|
|
"class"
|
|
|
|
|
"const"
|
|
|
|
|
"debugger"
|
|
|
|
|
"export"
|
|
|
|
|
"extends"
|
|
|
|
|
"function"
|
|
|
|
|
"get"
|
|
|
|
|
"in"
|
|
|
|
|
"instanceof"
|
|
|
|
|
"let"
|
|
|
|
|
"return"
|
|
|
|
|
"set"
|
|
|
|
|
"static"
|
|
|
|
|
"switch"
|
|
|
|
|
"target"
|
|
|
|
|
"typeof"
|
|
|
|
|
"var"
|
|
|
|
|
"void"
|
|
|
|
|
"with"
|
|
|
|
|
"yield"
|
|
|
|
|
] @keyword
|
2020-09-13 15:08:11 +02:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"new"
|
|
|
|
|
"delete"
|
|
|
|
|
] @keyword.operator
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"throw"
|
|
|
|
|
"try"
|
|
|
|
|
"catch"
|
|
|
|
|
"finally"
|
|
|
|
|
] @exception
|