Detailed changes
@@ -1,12 +1,62 @@
-("(" @open ")" @close)
-("[" @open "]" @close)
-("{" @open "}" @close)
-(("\"" @open "\"" @close) (#set! rainbow.exclude))
-(("`" @open "`" @close) (#set! rainbow.exclude))
-(("do" @open "done" @close) (#set! newline.only) (#set! rainbow.exclude))
-((case_statement ("in" @open "esac" @close)) (#set! newline.only) (#set! rainbow.exclude))
-((if_statement (elif_clause ("then" @open)) (else_clause ("else" @close))) (#set! newline.only) (#set! rainbow.exclude))
-((if_statement (else_clause ("else" @open)) "fi" @close) (#set! newline.only) (#set! rainbow.exclude))
-((if_statement ("then" @open) (elif_clause ("elif" @close))) (#set! newline.only) (#set! rainbow.exclude))
-((if_statement ("then" @open) (else_clause ("else" @close))) (#set! newline.only) (#set! rainbow.exclude))
-((if_statement ("then" @open "fi" @close)) (#set! newline.only) (#set! rainbow.exclude))
+("(" @open
+ ")" @close)
+
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+(("\"" @open
+ "\"" @close)
+ (#set! rainbow.exclude))
+
+(("`" @open
+ "`" @close)
+ (#set! rainbow.exclude))
+
+(("do" @open
+ "done" @close)
+ (#set! newline.only)
+ (#set! rainbow.exclude))
+
+((case_statement
+ ("in" @open
+ "esac" @close))
+ (#set! newline.only)
+ (#set! rainbow.exclude))
+
+((if_statement
+ (elif_clause
+ "then" @open)
+ (else_clause
+ "else" @close))
+ (#set! newline.only)
+ (#set! rainbow.exclude))
+
+((if_statement
+ (else_clause
+ "else" @open)
+ "fi" @close)
+ (#set! newline.only)
+ (#set! rainbow.exclude))
+
+((if_statement
+ "then" @open
+ (elif_clause
+ "elif" @close))
+ (#set! newline.only)
+ (#set! rainbow.exclude))
+
+((if_statement
+ "then" @open
+ (else_clause
+ "else" @close))
+ (#set! newline.only)
+ (#set! rainbow.exclude))
+
+((if_statement
+ ("then" @open
+ "fi" @close))
+ (#set! newline.only)
+ (#set! rainbow.exclude))
@@ -43,13 +43,17 @@
(comment) @keyword.directive)
(#match? @keyword.directive "^#![ \t]*/"))
-(function_definition name: (word) @function)
-(command_name (word) @function)
+(function_definition
+ name: (word) @function)
+
+(command_name
+ (word) @function)
(command
argument: [
(word) @variable.parameter
- (_ (word) @variable.parameter)
+ (_
+ (word) @variable.parameter)
])
[
@@ -65,7 +69,6 @@
(expansion)
] @embedded
-
[
"$"
"&&"
@@ -89,9 +92,7 @@
(test_operator) @keyword.operator
-[
- ";"
-] @punctuation.delimiter
+";" @punctuation.delimiter
[
"("
@@ -104,6 +105,7 @@
(simple_expansion
"$" @punctuation.special)
+
(expansion
"${" @punctuation.special
"}" @punctuation.special) @embedded
@@ -112,10 +114,11 @@
"$(" @punctuation.special
")" @punctuation.special)
-(
- (command (_) @constant)
- (#match? @constant "^-")
-)
+((command
+ (_) @constant)
+ (#match? @constant "^-"))
+
+(case_item
+ value: (_) @string.regex)
-(case_item value: (_) @string.regex)
(special_variable_name) @variable.special
@@ -1,12 +1,27 @@
-(_ "[" "]" @end) @indent
-(_ "{" "}" @end) @indent
-(_ "(" ")" @end) @indent
+(_
+ "["
+ "]" @end) @indent
+
+(_
+ "{"
+ "}" @end) @indent
+
+(_
+ "("
+ ")" @end) @indent
(function_definition) @start.function
+
(if_statement) @start.if
+
(elif_clause) @start.elif
+
(else_clause) @start.else
+
(for_statement) @start.for
+
(while_statement) @start.while
+
(case_statement) @start.case
+
(case_item) @start.case_item
@@ -1,3 +1,2 @@
((comment) @injection.content
- (#set! injection.language "comment")
-)
+ (#set! injection.language "comment"))
@@ -1,2 +1,3 @@
(comment) @comment.inclusive
+
(string) @string
@@ -1,2 +1,2 @@
(variable_assignment
- value: (_) @redact)
+ value: (_) @redact)
@@ -1,5 +1,5 @@
; Run bash scripts
-(
- (program . (_) @run) @_bash-script
- (#set! tag bash-script)
-)
+((program
+ .
+ (_) @run) @_bash-script
+ (#set! tag bash-script))
@@ -2,6 +2,6 @@
body: (_
"{"
(_)* @function.inside
- "}" )) @function.around
+ "}")) @function.around
(comment) @comment.around
@@ -1,5 +1,16 @@
-("(" @open ")" @close)
-("[" @open "]" @close)
-("{" @open "}" @close)
-(("\"" @open "\"" @close) (#set! rainbow.exclude))
-(("'" @open "'" @close) (#set! rainbow.exclude))
+("(" @open
+ ")" @close)
+
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+(("\"" @open
+ "\"" @close)
+ (#set! rainbow.exclude))
+
+(("'" @open
+ "'" @close)
+ (#set! rainbow.exclude))
@@ -116,19 +116,23 @@
(identifier) @variable
((identifier) @constant
- (#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
+ (#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
(call_expression
function: (identifier) @function)
+
(call_expression
function: (field_expression
field: (field_identifier) @function))
+
(function_declarator
declarator: (identifier) @function)
+
(preproc_function_def
name: (identifier) @function.special)
(field_identifier) @property
+
(statement_identifier) @label
[
@@ -139,6 +143,7 @@
; GNU __attribute__
(attribute_specifier) @attribute
+
(attribute_specifier
(argument_list
(identifier) @attribute))
@@ -146,5 +151,6 @@
; C23 [[attributes]]
(attribute
prefix: (identifier) @attribute)
+
(attribute
name: (identifier) @attribute)
@@ -1,7 +1,7 @@
(preproc_include
- path: [
- (
- (system_lib_string) @source @wildcard
- (#strip! @source "[<>]"))
- (string_literal (string_content) @source @wildcard)
- ]) @import
+ path: [
+ ((system_lib_string) @source @wildcard
+ (#strip! @source "[<>]"))
+ (string_literal
+ (string_content) @source @wildcard)
+ ]) @import
@@ -9,15 +9,25 @@
(else_clause)
] @indent
-(_ "{" "}" @end) @indent
-(_ "(" ")" @end) @indent
+(_
+ "{"
+ "}" @end) @indent
+
+(_
+ "("
+ ")" @end) @indent
((comment) @indent
- (#match? @indent "^/\\*"))
+ (#match? @indent "^/\\*"))
(if_statement) @start.if
+
(for_statement) @start.for
+
(while_statement) @start.while
+
(do_statement) @start.do
+
(switch_statement) @start.switch
+
(else_clause) @start.else
@@ -1,6 +1,5 @@
((comment) @injection.content
- (#set! injection.language "comment")
-)
+ (#set! injection.language "comment"))
((comment) @injection.content
(#match? @injection.content "^(///|//!|/\\*\\*|/\\*!)(.*)")
@@ -8,9 +7,9 @@
(#set! injection.include-children))
(preproc_def
- value: (preproc_arg) @injection.content
- (#set! injection.language "c"))
+ value: (preproc_arg) @injection.content
+ (#set! injection.language "c"))
(preproc_function_def
- value: (preproc_arg) @injection.content
- (#set! injection.language "c"))
+ value: (preproc_arg) @injection.content
+ (#set! injection.language "c"))
@@ -1,91 +1,89 @@
(preproc_def
- "#define" @context
- name: (_) @name) @item
+ "#define" @context
+ name: (_) @name) @item
(preproc_function_def
- "#define" @context
- name: (_) @name
- parameters: (preproc_params
- "(" @context
- ")" @context)) @item
+ "#define" @context
+ name: (_) @name
+ parameters: (preproc_params
+ "(" @context
+ ")" @context)) @item
(struct_specifier
- "struct" @context
- name: (_) @name) @item
+ "struct" @context
+ name: (_) @name) @item
(union_specifier
- "union" @context
- name: (_) @name) @item
+ "union" @context
+ name: (_) @name) @item
(enum_specifier
- "enum" @context
- name: (_) @name) @item
+ "enum" @context
+ name: (_) @name) @item
(enumerator
- name: (_) @name) @item
+ name: (_) @name) @item
(field_declaration
- type: (_) @context
- declarator: (field_identifier) @name) @item
+ type: (_) @context
+ declarator: (field_identifier) @name) @item
(type_definition
- "typedef" @context
- declarator: (_) @name) @item
+ "typedef" @context
+ declarator: (_) @name) @item
(declaration
- (type_qualifier)? @context
- type: (_)? @context
- declarator: [
- (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context))
- (pointer_declarator
- "*" @context
- declarator: (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context)))
- (pointer_declarator
- "*" @context
- declarator: (pointer_declarator
- "*" @context
- declarator: (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context))))
- ]
-) @item
+ (type_qualifier)? @context
+ type: (_)? @context
+ declarator: [
+ (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context))
+ (pointer_declarator
+ "*" @context
+ declarator: (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context)))
+ (pointer_declarator
+ "*" @context
+ declarator: (pointer_declarator
+ "*" @context
+ declarator: (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context))))
+ ]) @item
(function_definition
- (type_qualifier)? @context
- type: (_)? @context
- declarator: [
- (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context))
- (pointer_declarator
- "*" @context
- declarator: (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context)))
- (pointer_declarator
- "*" @context
- declarator: (pointer_declarator
- "*" @context
- declarator: (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context))))
- ]
-) @item
+ (type_qualifier)? @context
+ type: (_)? @context
+ declarator: [
+ (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context))
+ (pointer_declarator
+ "*" @context
+ declarator: (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context)))
+ (pointer_declarator
+ "*" @context
+ declarator: (pointer_declarator
+ "*" @context
+ declarator: (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context))))
+ ]) @item
(comment) @annotation
@@ -1,2 +1,3 @@
(comment) @comment.inclusive
+
(string_literal) @string
@@ -1,10 +1,6 @@
; Tag the main function
-(
- (function_definition
- declarator: (function_declarator
- declarator: (identifier) @run
- )
- ) @_c-main
+((function_definition
+ declarator: (function_declarator
+ declarator: (identifier) @run)) @_c-main
(#eq? @run "main")
- (#set! tag c-main)
-)
+ (#set! tag c-main))
@@ -1,31 +1,34 @@
(declaration
- declarator: (function_declarator)) @function.around
+ declarator: (function_declarator)) @function.around
(function_definition
- body: (_
- "{"
- (_)* @function.inside
- "}" )) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(preproc_function_def
- value: (_) @function.inside) @function.around
+ value: (_) @function.inside) @function.around
(comment) @comment.around
(struct_specifier
- body: (_
- "{"
- (_)* @class.inside
- "}")) @class.around
+ body: (_
+ "{"
+ (_)* @class.inside
+ "}")) @class.around
(enum_specifier
- body: (_
- "{"
- [(_) ","?]* @class.inside
- "}")) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ","?
+ ]* @class.inside
+ "}")) @class.around
(union_specifier
- body: (_
- "{"
- (_)* @class.inside
- "}")) @class.around
+ body: (_
+ "{"
+ (_)* @class.inside
+ "}")) @class.around
@@ -1,6 +1,19 @@
-("(" @open ")" @close)
-("[" @open "]" @close)
-("{" @open "}" @close)
-("<" @open ">" @close)
-(("\"" @open "\"" @close) (#set! rainbow.exclude))
-(("'" @open "'" @close) (#set! rainbow.exclude))
+("(" @open
+ ")" @close)
+
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+("<" @open
+ ">" @close)
+
+(("\"" @open
+ "\"" @close)
+ (#set! rainbow.exclude))
+
+(("'" @open
+ "'" @close)
+ (#set! rainbow.exclude))
@@ -1,13 +1,15 @@
(identifier) @variable
+
(field_identifier) @property
+
(namespace_identifier) @namespace
(concept_definition
- name: (identifier) @concept)
+ name: (identifier) @concept)
(requires_clause
- constraint: (template_type
- name: (type_identifier) @concept))
+ constraint: (template_type
+ name: (type_identifier) @concept))
(module_name
(identifier) @module)
@@ -83,18 +85,23 @@
(operator_name
"<=>" @operator.spaceship)
-(destructor_name (identifier) @function)
+(destructor_name
+ (identifier) @function)
((namespace_identifier) @type
- (#match? @type "^[A-Z]"))
+ (#match? @type "^[A-Z]"))
(auto) @type
+
(type_identifier) @type
+
type: (primitive_type) @type.builtin
+
(sized_type_specifier) @type.builtin
; GNU __attribute__
(attribute_specifier) @attribute
+
(attribute_specifier
(argument_list
(identifier) @attribute))
@@ -102,15 +109,18 @@ type: (primitive_type) @type.builtin
; C++11 [[attributes]]
(attribute
prefix: (identifier) @attribute)
+
(attribute
name: (identifier) @attribute)
((identifier) @constant.builtin
- (#match? @constant.builtin "^_*[A-Z][A-Z\\d_]*$"))
+ (#match? @constant.builtin "^_*[A-Z][A-Z\\d_]*$"))
(statement_identifier) @label
+
(this) @variable.builtin
-("static_assert") @function.builtin
+
+"static_assert" @function.builtin
[
"alignas"
@@ -197,7 +207,7 @@ type: (primitive_type) @type.builtin
[
(null)
- ("nullptr")
+ "nullptr"
] @constant.builtin
(number_literal) @number
@@ -285,5 +295,8 @@ type: (primitive_type) @type.builtin
(binary_expression
operator: "<=>" @operator.spaceship)
-(conditional_expression ":" @operator)
-(user_defined_literal (literal_suffix) @operator)
+(conditional_expression
+ ":" @operator)
+
+(user_defined_literal
+ (literal_suffix) @operator)
@@ -1,5 +1,6 @@
(preproc_include
- path: [
- ((system_lib_string) @source @wildcard)
- (string_literal (string_content) @source @wildcard)
- ]) @import
+ path: [
+ (system_lib_string) @source @wildcard
+ (string_literal
+ (string_content) @source @wildcard)
+ ]) @import
@@ -1,23 +1,33 @@
[
- (field_expression)
- (assignment_expression)
- (init_declarator)
- (if_statement)
- (for_statement)
- (while_statement)
- (do_statement)
- (else_clause)
+ (field_expression)
+ (assignment_expression)
+ (init_declarator)
+ (if_statement)
+ (for_statement)
+ (while_statement)
+ (do_statement)
+ (else_clause)
] @indent
-(_ "{" "}" @end) @indent
-(_ "(" ")" @end) @indent
+(_
+ "{"
+ "}" @end) @indent
+
+(_
+ "("
+ ")" @end) @indent
((comment) @indent
- (#match? @indent "^/\\*"))
+ (#match? @indent "^/\\*"))
(if_statement) @start.if
+
(for_statement) @start.for
+
(while_statement) @start.while
+
(do_statement) @start.do
+
(switch_statement) @start.switch
+
(else_clause) @start.else
@@ -1,6 +1,5 @@
((comment) @injection.content
- (#set! injection.language "comment")
-)
+ (#set! injection.language "comment"))
((comment) @injection.content
(#match? @injection.content "^(///|//!|/\\*\\*|/\\*!)(.*)")
@@ -8,12 +7,12 @@
(#set! injection.include-children))
(preproc_def
- value: (preproc_arg) @injection.content
- (#set! injection.language "c++"))
+ value: (preproc_arg) @injection.content
+ (#set! injection.language "c++"))
(preproc_function_def
- value: (preproc_arg) @injection.content
- (#set! injection.language "c++"))
+ value: (preproc_arg) @injection.content
+ (#set! injection.language "c++"))
(raw_string_literal
delimiter: (raw_string_delimiter) @injection.language
@@ -1,186 +1,195 @@
(preproc_def
- "#define" @context
- name: (_) @name) @item
+ "#define" @context
+ name: (_) @name) @item
(preproc_function_def
- "#define" @context
- name: (_) @name
- parameters: (preproc_params
- "(" @context
- ")" @context)) @item
+ "#define" @context
+ name: (_) @name
+ parameters: (preproc_params
+ "(" @context
+ ")" @context)) @item
(namespace_definition
- "inline"? @context
- "namespace" @context
- name: (_) @name) @item
+ "inline"? @context
+ "namespace" @context
+ name: (_) @name) @item
(type_definition
- "typedef" @context
- declarator: (_) @name) @item
+ "typedef" @context
+ declarator: (_) @name) @item
(struct_specifier
- "struct" @context
- name: (_) @name) @item
+ "struct" @context
+ name: (_) @name) @item
(class_specifier
- "class" @context
- name: (_) @name) @item
+ "class" @context
+ name: (_) @name) @item
(enum_specifier
- "enum" @context
- [
- "class"
- "struct"
- ]? @context
- name: (_) @name) @item
+ "enum" @context
+ [
+ "class"
+ "struct"
+ ]? @context
+ name: (_) @name) @item
(union_specifier
- "union" @context
- name: (_) @name) @item
+ "union" @context
+ name: (_) @name) @item
(enumerator
- name: (_) @name) @item
+ name: (_) @name) @item
(concept_definition
- "concept" @context
- name: (_) @name) @item
+ "concept" @context
+ name: (_) @name) @item
(declaration
- [
- (storage_class_specifier)
- (type_qualifier)
- ]* @context
- type: (_) @context
- declarator: [
- ; The declaration may define multiple variables, using @item on the
- ; declarator so that they get distinct ranges.
- (init_declarator
- declarator: (_) @item @name)
- (identifier) @item @name
- ] @item)
+ [
+ (storage_class_specifier)
+ (type_qualifier)
+ ]* @context
+ type: (_) @context
+ declarator: [
+ ; The declaration may define multiple variables, using @item on the
+ ; declarator so that they get distinct ranges.
+ (init_declarator
+ declarator: (_) @item @name)
+ (identifier) @item @name
+ ] @item)
(function_definition
- [
- (storage_class_specifier)
- (type_qualifier)
- ]* @context
- type: (_)? @context
- declarator: [
- (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context))
- (pointer_declarator
- "*" @context
- declarator: (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context)))
- (pointer_declarator
- "*" @context
- declarator: (pointer_declarator
- "*" @context
- declarator: (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context))))
- (reference_declarator
- ["&" "&&"] @context
- (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context)))
- ]
- (type_qualifier)? @context) @item
+ [
+ (storage_class_specifier)
+ (type_qualifier)
+ ]* @context
+ type: (_)? @context
+ declarator: [
+ (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context))
+ (pointer_declarator
+ "*" @context
+ declarator: (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context)))
+ (pointer_declarator
+ "*" @context
+ declarator: (pointer_declarator
+ "*" @context
+ declarator: (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context))))
+ (reference_declarator
+ [
+ "&"
+ "&&"
+ ] @context
+ (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context)))
+ ]
+ (type_qualifier)? @context) @item
(declaration
- [
- (storage_class_specifier)
- (type_qualifier)
- ]* @context
- type: (_)? @context
- declarator: [
- (field_identifier) @name
- (pointer_declarator
- "*" @context
- declarator: (field_identifier) @name)
- (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context))
- (pointer_declarator
- "*" @context
- declarator: (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context)))
- (pointer_declarator
- "*" @context
- declarator: (pointer_declarator
- "*" @context
- declarator: (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context))))
- (reference_declarator
- ["&" "&&"] @context
- (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context)))
- ]
- (type_qualifier)? @context) @item
+ [
+ (storage_class_specifier)
+ (type_qualifier)
+ ]* @context
+ type: (_)? @context
+ declarator: [
+ (field_identifier) @name
+ (pointer_declarator
+ "*" @context
+ declarator: (field_identifier) @name)
+ (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context))
+ (pointer_declarator
+ "*" @context
+ declarator: (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context)))
+ (pointer_declarator
+ "*" @context
+ declarator: (pointer_declarator
+ "*" @context
+ declarator: (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context))))
+ (reference_declarator
+ [
+ "&"
+ "&&"
+ ] @context
+ (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context)))
+ ]
+ (type_qualifier)? @context) @item
(field_declaration
- [
- (storage_class_specifier)
- (type_qualifier)
- ]* @context
- type: (_) @context
- declarator: [
- (field_identifier) @name
- (pointer_declarator
- "*" @context
- declarator: (field_identifier) @name)
- (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context))
- (pointer_declarator
- "*" @context
- declarator: (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context)))
- (pointer_declarator
- "*" @context
- declarator: (pointer_declarator
- "*" @context
- declarator: (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context))))
- (reference_declarator
- ["&" "&&"] @context
- (function_declarator
- declarator: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context)))
+ [
+ (storage_class_specifier)
+ (type_qualifier)
+ ]* @context
+ type: (_) @context
+ declarator: [
+ (field_identifier) @name
+ (pointer_declarator
+ "*" @context
+ declarator: (field_identifier) @name)
+ (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context))
+ (pointer_declarator
+ "*" @context
+ declarator: (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context)))
+ (pointer_declarator
+ "*" @context
+ declarator: (pointer_declarator
+ "*" @context
+ declarator: (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context))))
+ (reference_declarator
+ [
+ "&"
+ "&&"
+ ] @context
+ (function_declarator
+ declarator: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context)))
; Fields declarations may define multiple fields, and so @item is on the
; declarator so they each get distinct ranges.
- ] @item
- (type_qualifier)? @context)
+ ] @item
+ (type_qualifier)? @context)
(comment) @annotation
@@ -1,2 +1,3 @@
(comment) @comment.inclusive
+
(string_literal) @string
@@ -1,37 +1,44 @@
(declaration
- declarator: (function_declarator)) @function.around
+ declarator: (function_declarator)) @function.around
(function_definition
- body: (_
- "{"
- (_)* @function.inside
- "}" )) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(preproc_function_def
- value: (_) @function.inside) @function.around
+ value: (_) @function.inside) @function.around
(comment) @comment.around
(struct_specifier
- body: (_
- "{"
- (_)* @class.inside
- "}")) @class.around
+ body: (_
+ "{"
+ (_)* @class.inside
+ "}")) @class.around
(enum_specifier
- body: (_
- "{"
- [(_) ","?]* @class.inside
- "}")) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ","?
+ ]* @class.inside
+ "}")) @class.around
(union_specifier
- body: (_
- "{"
- (_)* @class.inside
- "}")) @class.around
+ body: (_
+ "{"
+ (_)* @class.inside
+ "}")) @class.around
(class_specifier
body: (_
- "{"
- [(_) ":"? ";"?]* @class.inside
- "}"?)) @class.around
+ "{"
+ [
+ (_)
+ ":"?
+ ";"?
+ ]* @class.inside
+ "}"?)) @class.around
@@ -1,5 +1,16 @@
-("(" @open ")" @close)
-("[" @open "]" @close)
-("{" @open "}" @close)
-(("\"" @open "\"" @close) (#set! rainbow.exclude))
-(("'" @open "'" @close) (#set! rainbow.exclude))
+("(" @open
+ ")" @close)
+
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+(("\"" @open
+ "\"" @close)
+ (#set! rainbow.exclude))
+
+(("'" @open
+ "'" @close)
+ (#set! rainbow.exclude))
@@ -30,14 +30,24 @@
] @keyword.operator
(id_name) @selector.id
+
(class_name) @selector.class
(namespace_name) @namespace
-(namespace_selector (tag_name) @namespace "|")
+
+(namespace_selector
+ (tag_name) @namespace
+ "|")
(attribute_name) @attribute
-(pseudo_element_selector "::" (tag_name) @selector.pseudo)
-(pseudo_class_selector ":" (class_name) @selector.pseudo)
+
+(pseudo_element_selector
+ "::"
+ (tag_name) @selector.pseudo)
+
+(pseudo_class_selector
+ ":"
+ (class_name) @selector.pseudo)
[
(feature_name)
@@ -58,13 +68,11 @@
(parenthesized_query
(keyword_query) @property)
-(
- [
- (property_name)
- (plain_value)
- ] @variable
- (#match? @variable "^--")
-)
+([
+ (property_name)
+ (plain_value)
+] @variable
+ (#match? @variable "^--"))
[
"@media"
@@ -80,6 +88,7 @@
] @keyword
(string_value) @string
+
(color_value) @string.special
[
@@ -97,7 +106,8 @@
";"
] @punctuation.delimiter
-(id_selector "#" @punctuation.delimiter)
+(id_selector
+ "#" @punctuation.delimiter)
[
"{"
@@ -1 +1,3 @@
-(_ "{" "}" @end) @indent
+(_
+ "{"
+ "}" @end) @indent
@@ -1,3 +1,2 @@
((comment) @injection.content
- (#set! injection.language "comment")
-)
+ (#set! injection.language "comment"))
@@ -1,18 +1,16 @@
(stylesheet
- (import_statement
- "@import" @context
- ((string_value) @name)) @item)
-
+ (import_statement
+ "@import" @context
+ (string_value) @name) @item)
(rule_set
- (selectors
- .
- (_) @name
- ("," @name (_) @name)*
- )) @item
+ (selectors
+ .
+ (_) @name
+ ("," @name
+ (_) @name)*)) @item
(media_statement
- "@media" @context
- (_) @name
- (block)
-) @item
+ "@media" @context
+ (_) @name
+ (block)) @item
@@ -1,2 +1,3 @@
(comment) @comment.inclusive
+
(string_value) @string
@@ -1,30 +1,31 @@
(comment) @comment.around
(rule_set
- (block (
- "{"
- (_)* @function.inside
- "}" ))) @function.around
+ (block
+ ("{"
+ (_)* @function.inside
+ "}"))) @function.around
+
(keyframe_block
- (block (
- "{"
- (_)* @function.inside
- "}" ))) @function.around
+ (block
+ ("{"
+ (_)* @function.inside
+ "}"))) @function.around
(media_statement
- (block (
- "{"
- (_)* @class.inside
- "}" ))) @class.around
+ (block
+ ("{"
+ (_)* @class.inside
+ "}"))) @class.around
(supports_statement
- (block (
- "{"
- (_)* @class.inside
- "}" ))) @class.around
+ (block
+ ("{"
+ (_)* @class.inside
+ "}"))) @class.around
(keyframes_statement
- (keyframe_block_list (
- "{"
- (_)* @class.inside
- "}" ))) @class.around
+ (keyframe_block_list
+ ("{"
+ (_)* @class.inside
+ "}"))) @class.around
@@ -4,14 +4,14 @@
(addition)
(new_file)
] @string
-;; TODO: This should eventually be `@diff.plus` with a fallback of `@string`
+; TODO: This should eventually be `@diff.plus` with a fallback of `@string`
[
(deletion)
(old_file)
] @keyword
-;; TODO: This should eventually be `@diff.minus` with a fallback of `@keyword`
+; TODO: This should eventually be `@diff.minus` with a fallback of `@keyword`
(commit) @constant
(location) @attribute
@@ -22,7 +22,7 @@
(mode) @number
-([
+[
".."
"+"
"++"
@@ -32,7 +32,7 @@
"--"
"---"
"----"
-] @punctuation.special)
+] @punctuation.special
[
(binary_change)
@@ -1,2 +1,2 @@
((comment) @injection.content
- (#set! injection.language "comment"))
+ (#set! injection.language "comment"))
@@ -1,18 +1,36 @@
(subject) @markup.heading
+
(path) @string.special.path
+
(branch) @string.special.symbol
+
(commit) @constant
+
(item) @markup.link.url
+
(header) @tag
+
(comment) @comment
-(change kind: "new file" @diff.plus)
-(change kind: "deleted" @diff.minus)
-(change kind: "modified" @diff.delta)
-(change kind: "renamed" @diff.delta.moved)
+(change
+ kind: "new file" @diff.plus)
+
+(change
+ kind: "deleted" @diff.minus)
+
+(change
+ kind: "modified" @diff.delta)
+
+(change
+ kind: "renamed" @diff.delta.moved)
(trailer
key: (trailer_key) @variable.other.member
value: (trailer_value) @string)
-[":" "=" "->" (scissors)] @punctuation.delimiter
+[
+ ":"
+ "="
+ "->"
+ (scissors)
+] @punctuation.delimiter
@@ -1,9 +1,8 @@
((comment) @content
- (#set! injection.language "comment")
-)
+ (#set! injection.language "comment"))
((scissors) @content
- (#set! "language" "diff"))
+ (#set! "language" "diff"))
((rebase_command) @content
- (#set! "language" "git_rebase"))
+ (#set! "language" "git_rebase"))
@@ -1,6 +1,19 @@
-("(" @open ")" @close)
-("[" @open "]" @close)
-("{" @open "}" @close)
-(("\"" @open "\"" @close) (#set! rainbow.exclude))
-(("`" @open "`" @close) (#set! rainbow.exclude))
-((rune_literal) @open @close (#set! rainbow.exclude))
+("(" @open
+ ")" @close)
+
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+(("\"" @open
+ "\"" @close)
+ (#set! rainbow.exclude))
+
+(("`" @open
+ "`" @close)
+ (#set! rainbow.exclude))
+
+((rune_literal) @open @close
+ (#set! rainbow.exclude))
@@ -1,26 +1,44 @@
-(parameter_declaration (identifier) @debug-variable)
+(parameter_declaration
+ (identifier) @debug-variable)
-(short_var_declaration (expression_list (identifier) @debug-variable))
+(short_var_declaration
+ (expression_list
+ (identifier) @debug-variable))
-(var_declaration (var_spec (identifier) @debug-variable))
+(var_declaration
+ (var_spec
+ (identifier) @debug-variable))
-(const_declaration (const_spec (identifier) @debug-variable))
+(const_declaration
+ (const_spec
+ (identifier) @debug-variable))
-(assignment_statement (expression_list (identifier) @debug-variable))
+(assignment_statement
+ (expression_list
+ (identifier) @debug-variable))
-(binary_expression (identifier) @debug-variable
+(binary_expression
+ (identifier) @debug-variable
(#not-match? @debug-variable "^[A-Z]"))
-(call_expression (argument_list (identifier) @debug-variable
- (#not-match? @debug-variable "^[A-Z]")))
+(call_expression
+ (argument_list
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]")))
-(return_statement (expression_list (identifier) @debug-variable
- (#not-match? @debug-variable "^[A-Z]")))
+(return_statement
+ (expression_list
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]")))
-(range_clause (expression_list (identifier) @debug-variable))
+(range_clause
+ (expression_list
+ (identifier) @debug-variable))
-(parenthesized_expression (identifier) @debug-variable
+(parenthesized_expression
+ (identifier) @debug-variable
(#not-match? @debug-variable "^[A-Z]"))
(block) @debug-scope
+
(function_declaration) @debug-scope
@@ -1,10 +1,12 @@
(identifier) @variable
(type_identifier) @type
+
(type_spec
name: (type_identifier) @type.definition)
(field_identifier) @property
+
(package_identifier) @namespace
(label_name) @label
@@ -26,6 +28,7 @@
(method_declaration
name: (field_identifier) @function.method)
+
(method_elem
name: (field_identifier) @function.method)
@@ -144,8 +147,7 @@
; Go directives
((comment) @preproc
- (#match? @preproc "^//go:"))
+ (#match? @preproc "^//go:"))
((comment) @preproc
- (#match? @preproc "^// \\+build"))
-
+ (#match? @preproc "^// \\+build"))
@@ -1,14 +1,12 @@
(import_spec
- name: [
- (dot)
- (package_identifier)
- ]
- path: (interpreted_string_literal
- (interpreted_string_literal_content) @namespace)
-) @wildcard @import
+ name: [
+ (dot)
+ (package_identifier)
+ ]
+ path: (interpreted_string_literal
+ (interpreted_string_literal_content) @namespace)) @wildcard @import
(import_spec
- !name
- path: (interpreted_string_literal
- (interpreted_string_literal_content) @namespace)
-) @wildcard @import
+ !name
+ path: (interpreted_string_literal
+ (interpreted_string_literal_content) @namespace)) @wildcard @import
@@ -1,9 +1,17 @@
[
- (assignment_statement)
- (call_expression)
- (selector_expression)
+ (assignment_statement)
+ (call_expression)
+ (selector_expression)
] @indent
-(_ "[" "]" @end) @indent
-(_ "{" "}" @end) @indent
-(_ "(" ")" @end) @indent
+(_
+ "["
+ "]" @end) @indent
+
+(_
+ "{"
+ "}" @end) @indent
+
+(_
+ "("
+ ")" @end) @indent
@@ -1,7 +1,6 @@
; Refer to https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/go/injections.scm#L4C1-L16C41
((comment) @injection.content
- (#set! injection.language "comment")
-)
+ (#set! injection.language "comment"))
(call_expression
(selector_expression) @_function
@@ -14,722 +13,718 @@
(raw_string_literal)
(interpreted_string_literal)
] @injection.content
- (#set! injection.language "regex")
- ))
+ (#set! injection.language "regex")))
; INJECT SQL
-(
- [
- (const_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (var_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (assignment_statement
- left: (expression_list)
- "="
+([
+ (const_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (var_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (assignment_statement
+ left: (expression_list)
+ "="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (short_var_declaration
+ left: (expression_list)
+ ":="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (composite_literal
+ body: (literal_value
+ (keyed_element
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (short_var_declaration
- left: (expression_list)
- ":="
+ value: (literal_element
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))))
+ (expression_statement
+ (call_expression
+ (argument_list
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (composite_literal
- body: (literal_value
- (keyed_element
- (comment) @_comment
- value: (literal_element
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))))
-
- (expression_statement
- (call_expression
- (argument_list
- (comment) @_comment
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- )))
- ]
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ])))
+]
(#match? @_comment "^\\/\\*\\s*sql\\s*\\*\\/$")
- (#set! injection.language "sql")
-)
+ (#set! injection.language "sql"))
; INJECT JSON
-(
- [
- (const_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (var_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (assignment_statement
- left: (expression_list)
- "="
+([
+ (const_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (var_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (assignment_statement
+ left: (expression_list)
+ "="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (short_var_declaration
+ left: (expression_list)
+ ":="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (composite_literal
+ body: (literal_value
+ (keyed_element
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (short_var_declaration
- left: (expression_list)
- ":="
+ value: (literal_element
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))))
+ (expression_statement
+ (call_expression
+ (argument_list
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (composite_literal
- body: (literal_value
- (keyed_element
- (comment) @_comment
- value: (literal_element
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))))
-
- (expression_statement
- (call_expression
- (argument_list
- (comment) @_comment
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- )))
- ]
- (#match? @_comment "^\\/\\*\\s*json\\s*\\*\\/") ; /* json */ or /*json*/
- (#set! injection.language "json")
-)
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ])))
+]
+ (#match? @_comment "^\\/\\*\\s*json\\s*\\*\\/")
+ ; /* json */ or /*json*/
+ (#set! injection.language "json"))
; INJECT YAML
-(
- [
- (const_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (var_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (assignment_statement
- left: (expression_list)
- "="
+([
+ (const_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (var_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (assignment_statement
+ left: (expression_list)
+ "="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (short_var_declaration
+ left: (expression_list)
+ ":="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (composite_literal
+ body: (literal_value
+ (keyed_element
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (short_var_declaration
- left: (expression_list)
- ":="
+ value: (literal_element
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))))
+ (expression_statement
+ (call_expression
+ (argument_list
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (composite_literal
- body: (literal_value
- (keyed_element
- (comment) @_comment
- value: (literal_element
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))))
-
- (expression_statement
- (call_expression
- (argument_list
- (comment) @_comment
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- )))
- ]
- (#match? @_comment "^\\/\\*\\s*yaml\\s*\\*\\/") ; /* yaml */ or /*yaml*/
- (#set! injection.language "yaml")
-)
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ])))
+]
+ (#match? @_comment "^\\/\\*\\s*yaml\\s*\\*\\/")
+ ; /* yaml */ or /*yaml*/
+ (#set! injection.language "yaml"))
; INJECT XML
-(
- [
- (const_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (var_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (assignment_statement
- left: (expression_list)
- "="
+([
+ (const_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (var_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (assignment_statement
+ left: (expression_list)
+ "="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (short_var_declaration
+ left: (expression_list)
+ ":="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (composite_literal
+ body: (literal_value
+ (keyed_element
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (short_var_declaration
- left: (expression_list)
- ":="
+ value: (literal_element
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))))
+ (expression_statement
+ (call_expression
+ (argument_list
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (composite_literal
- body: (literal_value
- (keyed_element
- (comment) @_comment
- value: (literal_element
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))))
-
- (expression_statement
- (call_expression
- (argument_list
- (comment) @_comment
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- )))
- ]
- (#match? @_comment "^\\/\\*\\s*xml\\s*\\*\\/") ; /* xml */ or /*xml*/
- (#set! injection.language "xml")
-)
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ])))
+]
+ (#match? @_comment "^\\/\\*\\s*xml\\s*\\*\\/")
+ ; /* xml */ or /*xml*/
+ (#set! injection.language "xml"))
; INJECT HTML
-(
- [
- (const_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (var_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (assignment_statement
- left: (expression_list)
- "="
+([
+ (const_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (var_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (assignment_statement
+ left: (expression_list)
+ "="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (short_var_declaration
+ left: (expression_list)
+ ":="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (composite_literal
+ body: (literal_value
+ (keyed_element
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (short_var_declaration
- left: (expression_list)
- ":="
+ value: (literal_element
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))))
+ (expression_statement
+ (call_expression
+ (argument_list
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (composite_literal
- body: (literal_value
- (keyed_element
- (comment) @_comment
- value: (literal_element
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))))
-
- (expression_statement
- (call_expression
- (argument_list
- (comment) @_comment
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- )))
- ]
- (#match? @_comment "^\\/\\*\\s*html\\s*\\*\\/") ; /* html */ or /*html*/
- (#set! injection.language "html")
-)
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ])))
+]
+ (#match? @_comment "^\\/\\*\\s*html\\s*\\*\\/")
+ ; /* html */ or /*html*/
+ (#set! injection.language "html"))
; INJECT JS
-(
- [
- (const_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (var_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (assignment_statement
- left: (expression_list)
- "="
+([
+ (const_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (var_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (assignment_statement
+ left: (expression_list)
+ "="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (short_var_declaration
+ left: (expression_list)
+ ":="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (composite_literal
+ body: (literal_value
+ (keyed_element
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (short_var_declaration
- left: (expression_list)
- ":="
+ value: (literal_element
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))))
+ (expression_statement
+ (call_expression
+ (argument_list
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (composite_literal
- body: (literal_value
- (keyed_element
- (comment) @_comment
- value: (literal_element
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))))
-
- (expression_statement
- (call_expression
- (argument_list
- (comment) @_comment
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- )))
- ]
- (#match? @_comment "^\\/\\*\\s*js\\s*\\*\\/") ; /* js */ or /*js*/
- (#set! injection.language "javascript")
-)
-
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ])))
+]
+ (#match? @_comment "^\\/\\*\\s*js\\s*\\*\\/")
+ ; /* js */ or /*js*/
+ (#set! injection.language "javascript"))
; INJECT CSS
-(
- [
- (const_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (var_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (assignment_statement
- left: (expression_list)
- "="
+([
+ (const_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (var_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (assignment_statement
+ left: (expression_list)
+ "="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (short_var_declaration
+ left: (expression_list)
+ ":="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (composite_literal
+ body: (literal_value
+ (keyed_element
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (short_var_declaration
- left: (expression_list)
- ":="
+ value: (literal_element
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))))
+ (expression_statement
+ (call_expression
+ (argument_list
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (composite_literal
- body: (literal_value
- (keyed_element
- (comment) @_comment
- value: (literal_element
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))))
-
- (expression_statement
- (call_expression
- (argument_list
- (comment) @_comment
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- )))
- ]
- (#match? @_comment "^\\/\\*\\s*css\\s*\\*\\/") ; /* css */ or /*css*/
- (#set! injection.language "css")
-)
-
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ])))
+]
+ (#match? @_comment "^\\/\\*\\s*css\\s*\\*\\/")
+ ; /* css */ or /*css*/
+ (#set! injection.language "css"))
; INJECT LUA
-(
- [
- (const_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (var_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (assignment_statement
- left: (expression_list)
- "="
+([
+ (const_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (var_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (assignment_statement
+ left: (expression_list)
+ "="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (short_var_declaration
+ left: (expression_list)
+ ":="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (composite_literal
+ body: (literal_value
+ (keyed_element
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (short_var_declaration
- left: (expression_list)
- ":="
+ value: (literal_element
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))))
+ (expression_statement
+ (call_expression
+ (argument_list
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (composite_literal
- body: (literal_value
- (keyed_element
- (comment) @_comment
- value: (literal_element
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))))
-
- (expression_statement
- (call_expression
- (argument_list
- (comment) @_comment
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- )))
- ]
- (#match? @_comment "^\\/\\*\\s*lua\\s*\\*\\/") ; /* lua */ or /*lua*/
- (#set! injection.language "lua")
-)
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ])))
+]
+ (#match? @_comment "^\\/\\*\\s*lua\\s*\\*\\/")
+ ; /* lua */ or /*lua*/
+ (#set! injection.language "lua"))
; INJECT BASH
-(
- [
- (const_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (var_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (assignment_statement
- left: (expression_list)
- "="
+([
+ (const_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (var_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (assignment_statement
+ left: (expression_list)
+ "="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (short_var_declaration
+ left: (expression_list)
+ ":="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (composite_literal
+ body: (literal_value
+ (keyed_element
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (short_var_declaration
- left: (expression_list)
- ":="
+ value: (literal_element
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))))
+ (expression_statement
+ (call_expression
+ (argument_list
(comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (composite_literal
- body: (literal_value
- (keyed_element
- (comment) @_comment
- value: (literal_element
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))))
-
- (expression_statement
- (call_expression
- (argument_list
- (comment) @_comment
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- )))
- ]
- (#match? @_comment "^\\/\\*\\s*bash\\s*\\*\\/") ; /* bash */ or /*bash*/
- (#set! injection.language "bash")
-)
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ])))
+]
+ (#match? @_comment "^\\/\\*\\s*bash\\s*\\*\\/")
+ ; /* bash */ or /*bash*/
+ (#set! injection.language "bash"))
; INJECT CSV
-(
+([
+ (const_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (var_spec
+ name: (identifier)
+ "="
+ (comment) @_comment
+ value: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (assignment_statement
+ left: (expression_list)
+ "="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (short_var_declaration
+ left: (expression_list)
+ ":="
+ (comment) @_comment
+ right: (expression_list
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ ((comment) @_comment
+ value: (literal_element
+ [
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ]))
+ (argument_list
+ (comment) @_comment
[
- (const_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (var_spec
- name: (identifier)
- "="
- (comment) @_comment
- value: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (assignment_statement
- left: (expression_list)
- "="
- (comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (short_var_declaration
- left: (expression_list)
- ":="
- (comment) @_comment
- right: (expression_list
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- ((comment) @_comment
- value: (literal_element
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- ))
-
- (argument_list
- (comment) @_comment
- [
- (interpreted_string_literal (interpreted_string_literal_content) @injection.content)
- (raw_string_literal (raw_string_literal_content) @injection.content)
- ]
- )
- ]
- (#match? @_comment "^\\/\\*\\s*csv\\s*\\*\\/") ; /* csv */ or /*csv */
- (#set! injection.language "csv")
-)
+ (interpreted_string_literal
+ (interpreted_string_literal_content) @injection.content)
+ (raw_string_literal
+ (raw_string_literal_content) @injection.content)
+ ])
+]
+ (#match? @_comment "^\\/\\*\\s*csv\\s*\\*\\/")
+ ; /* csv */ or /*csv */
+ (#set! injection.language "csv"))
@@ -1,67 +1,61 @@
(comment) @annotation
(type_declaration
- "type" @context
- [
- (type_spec
- name: (_) @name) @item
- (
- "("
- (type_spec
- name: (_) @name) @item
- ")"
- )
- ]
-)
+ "type" @context
+ [
+ (type_spec
+ name: (_) @name) @item
+ ("("
+ (type_spec
+ name: (_) @name) @item
+ ")")
+ ])
(function_declaration
- "func" @context
- name: (identifier) @name
- parameters: (parameter_list
- "("
- ")")) @item
+ "func" @context
+ name: (identifier) @name
+ parameters: (parameter_list
+ "("
+ ")")) @item
(method_declaration
- "func" @context
- receiver: (parameter_list
- "(" @context
- (parameter_declaration
- name: (_) @context
- type: (_) @context)
- ")" @context)
- name: (field_identifier) @name
- parameters: (parameter_list
- "("
- ")")) @item
+ "func" @context
+ receiver: (parameter_list
+ "(" @context
+ (parameter_declaration
+ name: (_) @context
+ type: (_) @context)
+ ")" @context)
+ name: (field_identifier) @name
+ parameters: (parameter_list
+ "("
+ ")")) @item
(const_declaration
- "const" @context
- (const_spec
- name: (identifier) @name) @item)
+ "const" @context
+ (const_spec
+ name: (identifier) @name) @item)
(source_file
- (var_declaration
- "var" @context
- [
- ; The declaration may define multiple variables, and so @item is on
- ; the identifier so they get distinct ranges.
- (var_spec
- name: (identifier) @name @item)
- (var_spec_list
- (var_spec
- name: (identifier) @name @item)
- )
- ]
- )
-)
+ (var_declaration
+ "var" @context
+ [
+ ; The declaration may define multiple variables, and so @item is on
+ ; the identifier so they get distinct ranges.
+ (var_spec
+ name: (identifier) @name @item)
+ (var_spec_list
+ (var_spec
+ name: (identifier) @name @item))
+ ]))
(method_elem
- name: (_) @name
- parameters: (parameter_list
- "(" @context
- ")" @context)) @item
+ name: (_) @name
+ parameters: (parameter_list
+ "(" @context
+ ")" @context)) @item
; Fields declarations may define multiple fields, and so @item is on the
; declarator so they each get distinct ranges.
(field_declaration
- name: (_) @name @item)
+ name: (_) @name @item)
@@ -1,4 +1,5 @@
(comment) @comment.inclusive
+
[
(interpreted_string_literal)
(raw_string_literal)
@@ -1,170 +1,118 @@
; Functions names start with `Test`
-(
- (
- (function_declaration name: (_) @run
- (#match? @run "^Test.*")
- (#not-match? @run "^TestMain$"))
- ) @_
- (#set! tag go-test)
-)
+(((function_declaration
+ name: (_) @run
+ (#match? @run "^Test.*")
+ (#not-match? @run "^TestMain$"))) @_
+ (#set! tag go-test))
; Suite test methods (testify/suite)
-(
- (method_declaration
- receiver: (parameter_list
- (parameter_declaration
- type: [
- (pointer_type (type_identifier) @_suite_name)
- (type_identifier) @_suite_name
- ]
- )
- )
- name: (field_identifier) @run @_subtest_name
- (#match? @_subtest_name "^Test.*")
- (#match? @_suite_name ".*Suite")
- ) @_
- (#set! tag go-testify-suite)
-)
+((method_declaration
+ receiver: (parameter_list
+ (parameter_declaration
+ type: [
+ (pointer_type
+ (type_identifier) @_suite_name)
+ (type_identifier) @_suite_name
+ ]))
+ name: (field_identifier) @run @_subtest_name
+ (#match? @_subtest_name "^Test.*")
+ (#match? @_suite_name ".*Suite")) @_
+ (#set! tag go-testify-suite))
; `go:generate` comments
-(
- ((comment) @_comment @run
- (#match? @_comment "^//go:generate"))
- (#set! tag go-generate)
-)
+(((comment) @_comment @run
+ (#match? @_comment "^//go:generate"))
+ (#set! tag go-generate))
; `t.Run`
-(
- (
- (call_expression
- function: (
- selector_expression
- field: _ @run @_name
- (#eq? @_name "Run")
- )
- arguments: (
- argument_list
- .
- [
- (interpreted_string_literal)
- (raw_string_literal)
- ] @_subtest_name
- .
- (func_literal
- parameters: (
- parameter_list
- (parameter_declaration
- name: (identifier) @_param_name
- type: (pointer_type
- (qualified_type
- package: (package_identifier) @_pkg
- name: (type_identifier) @_type
- (#eq? @_pkg "testing")
- (#eq? @_type "T")
- )
- )
- )
- )
- ) @_second_argument
- )
- )
- ) @_
- (#set! tag go-subtest)
-)
+(((call_expression
+ function: (selector_expression
+ field: _ @run @_name
+ (#eq? @_name "Run"))
+ arguments: (argument_list
+ .
+ [
+ (interpreted_string_literal)
+ (raw_string_literal)
+ ] @_subtest_name
+ .
+ (func_literal
+ parameters: (parameter_list
+ (parameter_declaration
+ name: (identifier) @_param_name
+ type: (pointer_type
+ (qualified_type
+ package: (package_identifier) @_pkg
+ name: (type_identifier) @_type
+ (#eq? @_pkg "testing")
+ (#eq? @_type "T")))))) @_second_argument))) @_
+ (#set! tag go-subtest))
; Functions names start with `Example`
-(
- (
- (function_declaration name: (_) @run @_name
- (#match? @_name "^Example.*"))
- ) @_
- (#set! tag go-example)
-)
+(((function_declaration
+ name: (_) @run @_name
+ (#match? @_name "^Example.*"))) @_
+ (#set! tag go-example))
; Functions names start with `Benchmark`
-(
- (
- (function_declaration name: (_) @run @_name
- (#match? @_name "^Benchmark.*"))
- ) @_
- (#set! tag go-benchmark)
-)
+(((function_declaration
+ name: (_) @run @_name
+ (#match? @_name "^Benchmark.*"))) @_
+ (#set! tag go-benchmark))
; Functions names start with `Fuzz`
-(
- (
- (function_declaration name: (_) @run @_name
- (#match? @_name "^Fuzz"))
- ) @_
- (#set! tag go-fuzz)
-)
+(((function_declaration
+ name: (_) @run @_name
+ (#match? @_name "^Fuzz"))) @_
+ (#set! tag go-fuzz))
; go run
-(
- (
- (function_declaration name: (_) @run
- (#eq? @run "main"))
- ) @_
- (#set! tag go-main)
-)
+(((function_declaration
+ name: (_) @run
+ (#eq? @run "main"))) @_
+ (#set! tag go-main))
; Table test cases - slice and map with explicit variable
-(
- (short_var_declaration
- left: (expression_list (identifier) @_collection_var)
- right: (expression_list
- (composite_literal
- type: [
- (slice_type)
- (map_type
- key: (type_identifier) @_key_type
- (#eq? @_key_type "string")
- )
- ]
- body: (literal_value
- [
+((short_var_declaration
+ left: (expression_list
+ (identifier) @_collection_var)
+ right: (expression_list
+ (composite_literal
+ type: [
+ (slice_type)
+ (map_type
+ key: (type_identifier) @_key_type
+ (#eq? @_key_type "string"))
+ ]
+ body: (literal_value
+ [
+ (literal_element
+ (literal_value
+ (keyed_element
+ (literal_element
+ (identifier) @_field_name)
+ (literal_element
+ [
+ (interpreted_string_literal) @run @_table_test_case_name
+ (raw_string_literal) @run @_table_test_case_name
+ ]))))
+ (keyed_element
(literal_element
- (literal_value
- (keyed_element
- (literal_element
- (identifier) @_field_name
- )
- (literal_element
- [
- (interpreted_string_literal) @run @_table_test_case_name
- (raw_string_literal) @run @_table_test_case_name
- ]
- )
- )
- )
- )
- (keyed_element
- (literal_element
- [
- (interpreted_string_literal) @run @_table_test_case_name
- (raw_string_literal) @run @_table_test_case_name
- ]
- )
- )
- ]
- )
- )
- )
- )
+ [
+ (interpreted_string_literal) @run @_table_test_case_name
+ (raw_string_literal) @run @_table_test_case_name
+ ]))
+ ]))))
(for_statement
(range_clause
left: (expression_list
[
- (
- (identifier)
- (identifier) @_loop_var_inner
- )
+ ((identifier)
+ (identifier) @_loop_var_inner)
(identifier) @_loop_var_outer
- ]
- )
+ ])
right: (identifier) @_range_var
- (#eq? @_range_var @_collection_var)
- )
+ (#eq? @_range_var @_collection_var))
body: (block
(statement_list
(expression_statement
@@ -172,8 +120,7 @@
function: (selector_expression
operand: (identifier)
field: (field_identifier) @_run_method
- (#eq? @_run_method "Run")
- )
+ (#eq? @_run_method "Run"))
arguments: (argument_list
.
[
@@ -181,8 +128,7 @@
operand: (identifier) @_tc_var
(#eq? @_tc_var @_loop_var_inner)
field: (field_identifier) @_field_check
- (#eq? @_field_check @_field_name)
- )
+ (#eq? @_field_check @_field_name))
(identifier) @_arg_var
(#eq? @_arg_var @_loop_var_outer)
]
@@ -195,113 +141,72 @@
package: (package_identifier) @_pkg
name: (type_identifier) @_type
(#eq? @_pkg "testing")
- (#eq? @_type "T")
- )
- )
- )
- )
- )
- )
- )
- )
- )
- )
- ) @_
- (#set! tag go-table-test-case)
-)
+ (#eq? @_type "T")))))))))))) @_
+ (#set! tag go-table-test-case))
; Table test cases - slice and map declared right inside the loop without
; explicit variable
-(
- (for_statement
- (range_clause
- left: (expression_list
+((for_statement
+ (range_clause
+ left: (expression_list
+ [
+ ((identifier)
+ (identifier) @_loop_var_inner)
+ (identifier) @_loop_var_outer
+ ])
+ right: (composite_literal
+ type: [
+ (slice_type)
+ (map_type
+ key: (type_identifier) @_key_type
+ (#eq? @_key_type "string"))
+ ]
+ body: (literal_value
[
- (
- (identifier)
- (identifier) @_loop_var_inner
- )
- (identifier) @_loop_var_outer
- ]
- )
- right: (composite_literal
- type: [
- (slice_type)
- (map_type
- key: (type_identifier) @_key_type
- (#eq? @_key_type "string")
- )
- ]
- body: (literal_value
- [
+ (literal_element
+ (literal_value
+ (keyed_element
+ (literal_element
+ (identifier) @_field_name)
+ (literal_element
+ [
+ (interpreted_string_literal) @run @_table_test_case_name
+ (raw_string_literal) @run @_table_test_case_name
+ ]))))
+ (keyed_element
(literal_element
- (literal_value
- (keyed_element
- (literal_element
- (identifier) @_field_name
- )
- (literal_element
- [
- (interpreted_string_literal) @run @_table_test_case_name
- (raw_string_literal) @run @_table_test_case_name
- ]
- )
- )
- )
- )
- (keyed_element
- (literal_element
- [
- (interpreted_string_literal) @run @_table_test_case_name
- (raw_string_literal) @run @_table_test_case_name
- ]
- )
- )
- ]
- )
- )
- )
- body: (block
- (statement_list
- (expression_statement
- (call_expression
- function: (selector_expression
- operand: (identifier)
- field: (field_identifier) @_run_method
- (#eq? @_run_method "Run")
- )
- arguments: (argument_list
- .
[
- (selector_expression
- operand: (identifier) @_tc_var
- (#eq? @_tc_var @_loop_var_inner)
- field: (field_identifier) @_field_check
- (#eq? @_field_check @_field_name)
- )
- (identifier) @_arg_var
- (#eq? @_arg_var @_loop_var_outer)
- ]
- .
- (func_literal
- parameters: (parameter_list
- (parameter_declaration
- type: (pointer_type
- (qualified_type
- package: (package_identifier) @_pkg
- name: (type_identifier) @_type
- (#eq? @_pkg "testing")
- (#eq? @_type "T")
- )
- )
- )
- )
- )
- )
- )
- )
- )
- )
- ) @_
- (#set! tag go-table-test-case-without-explicit-variable)
-)
+ (interpreted_string_literal) @run @_table_test_case_name
+ (raw_string_literal) @run @_table_test_case_name
+ ]))
+ ])))
+ body: (block
+ (statement_list
+ (expression_statement
+ (call_expression
+ function: (selector_expression
+ operand: (identifier)
+ field: (field_identifier) @_run_method
+ (#eq? @_run_method "Run"))
+ arguments: (argument_list
+ .
+ [
+ (selector_expression
+ operand: (identifier) @_tc_var
+ (#eq? @_tc_var @_loop_var_inner)
+ field: (field_identifier) @_field_check
+ (#eq? @_field_check @_field_name))
+ (identifier) @_arg_var
+ (#eq? @_arg_var @_loop_var_outer)
+ ]
+ .
+ (func_literal
+ parameters: (parameter_list
+ (parameter_declaration
+ type: (pointer_type
+ (qualified_type
+ package: (package_identifier) @_pkg
+ name: (type_identifier) @_type
+ (#eq? @_pkg "testing")
+ (#eq? @_type "T")))))))))))) @_
+ (#set! tag go-table-test-case-without-explicit-variable))
@@ -1,24 +1,27 @@
(function_declaration
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(method_declaration
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(type_declaration
- (type_spec (struct_type (field_declaration_list (
- "{"
- (_)* @class.inside
- "}")?)))) @class.around
+ (type_spec
+ (struct_type
+ (field_declaration_list
+ ("{"
+ (_)* @class.inside
+ "}")?)))) @class.around
(type_declaration
- (type_spec (interface_type
- (_)* @class.inside))) @class.around
+ (type_spec
+ (interface_type
+ (_)* @class.inside))) @class.around
(type_declaration) @class.around
@@ -15,6 +15,6 @@
(comment) @comment
[
-(version)
-(go_version)
+ (version)
+ (go_version)
] @string
@@ -1,2 +1,2 @@
((comment) @injection.content
- (#set! injection.language "comment"))
+ (#set! injection.language "comment"))
@@ -1,35 +1,29 @@
(require_directive
"require" @structure.anchor
- ("(") @structure.open
- (")") @structure.close
-)
+ "(" @structure.open
+ ")" @structure.close)
(exclude_directive
"exclude" @structure.anchor
- ("(") @structure.open
- (")") @structure.close
-)
+ "(" @structure.open
+ ")" @structure.close)
(module_directive
"module" @structure.anchor
- ("(") @structure.open
- (")") @structure.close
-)
+ "(" @structure.open
+ ")" @structure.close)
(replace_directive
"replace" @structure.anchor
- ("(") @structure.open
- (")") @structure.close
-)
+ "(" @structure.open
+ ")" @structure.close)
(retract_directive
"retract" @structure.anchor
- ("(") @structure.open
- (")") @structure.close
-)
+ "(" @structure.open
+ ")" @structure.close)
(ignore_directive
"ignore" @structure.anchor
- ("(") @structure.open
- (")") @structure.close
-)
+ "(" @structure.open
+ ")" @structure.close)
@@ -9,6 +9,6 @@
(comment) @comment
[
-(version)
-(go_version)
+ (version)
+ (go_version)
] @string
@@ -1,2 +1,2 @@
((comment) @injection.content
- (#set! injection.language "comment"))
+ (#set! injection.language "comment"))
@@ -1,9 +1,29 @@
-("(" @open ")" @close)
-("[" @open "]" @close)
-("{" @open "}" @close)
-("<" @open ">" @close)
-("<" @open "/>" @close)
-("</" @open ">" @close)
-(("\"" @open "\"" @close) (#set! rainbow.exclude))
-(("'" @open "'" @close) (#set! rainbow.exclude))
-(("`" @open "`" @close) (#set! rainbow.exclude))
+("(" @open
+ ")" @close)
+
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+("<" @open
+ ">" @close)
+
+("<" @open
+ "/>" @close)
+
+("</" @open
+ ">" @close)
+
+(("\"" @open
+ "\"" @close)
+ (#set! rainbow.exclude))
+
+(("'" @open
+ "'" @close)
+ (#set! rainbow.exclude))
+
+(("`" @open
+ "`" @close)
+ (#set! rainbow.exclude))
@@ -1,23 +1,51 @@
-(lexical_declaration (variable_declarator name: (identifier) @debug-variable))
+(lexical_declaration
+ (variable_declarator
+ name: (identifier) @debug-variable))
-(for_in_statement left: (identifier) @debug-variable)
-(for_statement initializer: (lexical_declaration (variable_declarator name: (identifier) @debug-variable)))
+(for_in_statement
+ left: (identifier) @debug-variable)
-(binary_expression left: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
-(binary_expression right: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(for_statement
+ initializer: (lexical_declaration
+ (variable_declarator
+ name: (identifier) @debug-variable)))
-(unary_expression argument: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
-(update_expression argument: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(binary_expression
+ left: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(return_statement (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(binary_expression
+ right: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(parenthesized_expression (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(unary_expression
+ argument: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(array (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(update_expression
+ argument: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(pair value: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(return_statement
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(member_expression object: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(parenthesized_expression
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(array
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(pair
+ value: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(member_expression
+ object: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
(statement_block) @debug-scope
+
(program) @debug-scope
@@ -1,56 +1,33 @@
; Variables
-
(identifier) @variable
(call_expression
function: (member_expression
object: (identifier) @type
- (#any-of?
- @type
- "Promise"
- "Array"
- "Object"
- "Map"
- "Set"
- "WeakMap"
- "WeakSet"
- "Date"
- "Error"
- "TypeError"
- "RangeError"
- "SyntaxError"
- "ReferenceError"
- "EvalError"
- "URIError"
- "RegExp"
- "Function"
- "Number"
- "String"
- "Boolean"
- "Symbol"
- "BigInt"
- "Proxy"
- "ArrayBuffer"
- "DataView"
- )
- )
-)
+ (#any-of? @type
+ "Promise" "Array" "Object" "Map" "Set" "WeakMap" "WeakSet" "Date" "Error" "TypeError"
+ "RangeError" "SyntaxError" "ReferenceError" "EvalError" "URIError" "RegExp" "Function"
+ "Number" "String" "Boolean" "Symbol" "BigInt" "Proxy" "ArrayBuffer" "DataView")))
; Properties
-
(property_identifier) @property
+
(shorthand_property_identifier) @property
+
(shorthand_property_identifier_pattern) @property
+
(private_property_identifier) @property
; Function and method calls
-
(call_expression
function: (identifier) @function)
(call_expression
function: (member_expression
- property: [(property_identifier) (private_property_identifier)] @function.method))
+ property: [
+ (property_identifier)
+ (private_property_identifier)
+ ] @function.method))
(new_expression
constructor: (identifier) @type)
@@ -59,36 +36,58 @@
module: (identifier) @type)
; Function and method definitions
-
(function_expression
name: (identifier) @function)
+
(function_declaration
name: (identifier) @function)
+
(method_definition
- name: [(property_identifier) (private_property_identifier)] @function.method)
+ name: [
+ (property_identifier)
+ (private_property_identifier)
+ ] @function.method)
+
(method_definition
- name: (property_identifier) @constructor
- (#eq? @constructor "constructor"))
+ name: (property_identifier) @constructor
+ (#eq? @constructor "constructor"))
(pair
- key: [(property_identifier) (private_property_identifier)] @function.method
- value: [(function_expression) (arrow_function)])
+ key: [
+ (property_identifier)
+ (private_property_identifier)
+ ] @function.method
+ value: [
+ (function_expression)
+ (arrow_function)
+ ])
(assignment_expression
left: (member_expression
- property: [(property_identifier) (private_property_identifier)] @function.method)
- right: [(function_expression) (arrow_function)])
+ property: [
+ (property_identifier)
+ (private_property_identifier)
+ ] @function.method)
+ right: [
+ (function_expression)
+ (arrow_function)
+ ])
(variable_declarator
name: (identifier) @function
- value: [(function_expression) (arrow_function)])
+ value: [
+ (function_expression)
+ (arrow_function)
+ ])
(assignment_expression
left: (identifier) @function
- right: [(function_expression) (arrow_function)])
+ right: [
+ (function_expression)
+ (arrow_function)
+ ])
; Parameters
-
(required_parameter
(identifier) @variable.parameter)
@@ -121,6 +120,7 @@
; Special identifiers
;
(type_identifier) @type
+
(predefined_type) @type.builtin
(class_declaration
@@ -133,12 +133,12 @@
(identifier)
(shorthand_property_identifier)
(shorthand_property_identifier_pattern)
- ] @constant
- (#match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
+] @constant
+ (#match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
; Literals
-
(this) @variable.special
+
(super) @variable.special
[
@@ -163,11 +163,12 @@
(escape_sequence) @string.escape
(regex) @string.regex
+
(regex_flags) @keyword.operator.regex
+
(number) @number
; Tokens
-
[
";"
"?."
@@ -224,7 +225,8 @@
"..."
] @operator
-(regex "/" @string.regex)
+(regex
+ "/" @string.regex)
[
"("
@@ -233,14 +235,13 @@
"]"
"{"
"}"
-] @punctuation.bracket
+] @punctuation.bracket
(ternary_expression
[
"?"
":"
- ] @operator
-)
+ ] @operator)
[
"abstract"
@@ -310,7 +311,8 @@
"yield"
] @keyword.control
-(switch_default "default" @keyword.control)
+(switch_default
+ "default" @keyword.control)
(template_substitution
"${" @punctuation.special
@@ -320,7 +322,8 @@
"<" @punctuation.bracket
">" @punctuation.bracket)
-(decorator "@" @punctuation.special)
+(decorator
+ "@" @punctuation.special)
; JSX elements
(jsx_opening_element
@@ -328,36 +331,61 @@
(identifier) @type
(member_expression
object: (identifier) @type
- property: (property_identifier) @type
- )
- ]
-)
+ property: (property_identifier) @type)
+ ])
+
(jsx_closing_element
[
(identifier) @type
(member_expression
object: (identifier) @type
- property: (property_identifier) @type
- )
- ]
-)
+ property: (property_identifier) @type)
+ ])
+
(jsx_self_closing_element
[
(identifier) @type
(member_expression
object: (identifier) @type
- property: (property_identifier) @type
- )
- ]
-)
-
-(jsx_opening_element (identifier) @tag.jsx (#match? @tag.jsx "^[a-z][^.]*$"))
-(jsx_closing_element (identifier) @tag.jsx (#match? @tag.jsx "^[a-z][^.]*$"))
-(jsx_self_closing_element (identifier) @tag.jsx (#match? @tag.jsx "^[a-z][^.]*$"))
-(jsx_attribute (property_identifier) @attribute.jsx)
-(jsx_opening_element (["<" ">"]) @punctuation.bracket.jsx)
-(jsx_closing_element (["</" ">"]) @punctuation.bracket.jsx)
-(jsx_self_closing_element (["<" "/>"]) @punctuation.bracket.jsx)
-(jsx_attribute "=" @punctuation.delimiter.jsx)
+ property: (property_identifier) @type)
+ ])
+
+(jsx_opening_element
+ (identifier) @tag.jsx
+ (#match? @tag.jsx "^[a-z][^.]*$"))
+
+(jsx_closing_element
+ (identifier) @tag.jsx
+ (#match? @tag.jsx "^[a-z][^.]*$"))
+
+(jsx_self_closing_element
+ (identifier) @tag.jsx
+ (#match? @tag.jsx "^[a-z][^.]*$"))
+
+(jsx_attribute
+ (property_identifier) @attribute.jsx)
+
+(jsx_opening_element
+ ([
+ "<"
+ ">"
+ ]) @punctuation.bracket.jsx)
+
+(jsx_closing_element
+ ([
+ "</"
+ ">"
+ ]) @punctuation.bracket.jsx)
+
+(jsx_self_closing_element
+ ([
+ "<"
+ "/>"
+ ]) @punctuation.bracket.jsx)
+
+(jsx_attribute
+ "=" @punctuation.delimiter.jsx)
+
(jsx_text) @text.jsx
+
(html_character_reference) @string.special
@@ -1,14 +1,16 @@
(import_statement
- import_clause: (import_clause
- [
- (identifier) @name
- (named_imports
- (import_specifier
- name: (_) @name
- alias: (_)? @alias))
- ])
- source: (string (string_fragment) @source)) @import
+ import_clause: (import_clause
+ [
+ (identifier) @name
+ (named_imports
+ (import_specifier
+ name: (_) @name
+ alias: (_)? @alias))
+ ])
+ source: (string
+ (string_fragment) @source)) @import
(import_statement
- !import_clause
- source: (string (string_fragment) @source @wildcard)) @import
+ !import_clause
+ source: (string
+ (string_fragment) @source @wildcard)) @import
@@ -1,20 +1,32 @@
[
- (call_expression)
- (assignment_expression)
- (member_expression)
- (lexical_declaration)
- (variable_declaration)
- (assignment_expression)
- (if_statement)
- (for_statement)
+ (call_expression)
+ (assignment_expression)
+ (member_expression)
+ (lexical_declaration)
+ (variable_declaration)
+ (assignment_expression)
+ (if_statement)
+ (for_statement)
] @indent
-(_ "[" "]" @end) @indent
-(_ "<" ">" @end) @indent
-(_ "{" "}" @end) @indent
-(_ "(" ")" @end) @indent
+(_
+ "["
+ "]" @end) @indent
-(jsx_opening_element ">" @end) @indent
+(_
+ "<"
+ ">" @end) @indent
+
+(_
+ "{"
+ "}" @end) @indent
+
+(_
+ "("
+ ")" @end) @indent
+
+(jsx_opening_element
+ ">" @end) @indent
(jsx_element
(jsx_opening_element) @start
@@ -1,6 +1,5 @@
((comment) @injection.content
- (#set! injection.language "comment")
-)
+ (#set! injection.language "comment"))
(((comment) @_jsdoc_comment
(#match? @_jsdoc_comment "(?s)^/[*][*][^*].*[*]/$")) @injection.content
@@ -10,119 +9,136 @@
(#set! injection.language "regex"))
(call_expression
- function: (identifier) @_name (#eq? @_name "css")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "css"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "css")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "css")))
(call_expression
function: (member_expression
- object: (identifier) @_obj (#eq? @_obj "styled")
+ object: (identifier) @_obj
+ (#eq? @_obj "styled")
property: (property_identifier))
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "css"))
-)
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "css")))
(call_expression
function: (call_expression
- function: (identifier) @_name (#eq? @_name "styled"))
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "css"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "styled"))
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "css")))
(call_expression
- function: (identifier) @_name (#eq? @_name "html")
+ function: (identifier) @_name
+ (#eq? @_name "html")
arguments: (template_string) @injection.content
- (#set! injection.language "html")
-)
+ (#set! injection.language "html"))
(call_expression
- function: (identifier) @_name (#eq? @_name "js")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "javascript"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "js")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "javascript")))
(call_expression
- function: (identifier) @_name (#eq? @_name "json")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "json"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "json")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "json")))
(call_expression
- function: (identifier) @_name (#eq? @_name "sql")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "sql"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "sql")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "sql")))
(call_expression
- function: (identifier) @_name (#eq? @_name "ts")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "typescript"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "ts")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "typescript")))
(call_expression
- function: (identifier) @_name (#match? @_name "^ya?ml$")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "yaml"))
-)
+ function: (identifier) @_name
+ (#match? @_name "^ya?ml$")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "yaml")))
(call_expression
- function: (identifier) @_name (#match? @_name "^g(raph)?ql$")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "graphql"))
-)
+ function: (identifier) @_name
+ (#match? @_name "^g(raph)?ql$")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "graphql")))
(call_expression
- function: (identifier) @_name (#match? @_name "^g(raph)?ql$")
- arguments: (arguments (template_string (string_fragment) @injection.content
- (#set! injection.language "graphql")))
-)
+ function: (identifier) @_name
+ (#match? @_name "^g(raph)?ql$")
+ arguments: (arguments
+ (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "graphql"))))
(call_expression
- function: (identifier) @_name(#match? @_name "^iso$")
- arguments: (arguments (template_string (string_fragment) @injection.content
- (#set! injection.language "isograph")))
-)
+ function: (identifier) @_name
+ (#match? @_name "^iso$")
+ arguments: (arguments
+ (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "isograph"))))
; Parse the contents of strings and tagged template
; literals with leading ECMAScript comments:
; '/* html */' or '/*html*/'
-(
- ((comment) @_ecma_comment [
- (string (string_fragment) @injection.content)
- (template_string (string_fragment) @injection.content)
+(((comment) @_ecma_comment
+ [
+ (string
+ (string_fragment) @injection.content)
+ (template_string
+ (string_fragment) @injection.content)
])
(#match? @_ecma_comment "^\\/\\*\\s*html\\s*\\*\\/")
- (#set! injection.language "html")
-)
+ (#set! injection.language "html"))
; '/* sql */' or '/*sql*/'
-(
- ((comment) @_ecma_comment [
- (string (string_fragment) @injection.content)
- (template_string (string_fragment) @injection.content)
+(((comment) @_ecma_comment
+ [
+ (string
+ (string_fragment) @injection.content)
+ (template_string
+ (string_fragment) @injection.content)
])
(#match? @_ecma_comment "^\\/\\*\\s*sql\\s*\\*\\/")
- (#set! injection.language "sql")
-)
+ (#set! injection.language "sql"))
; '/* gql */' or '/*gql*/'
; '/* graphql */' or '/*graphql*/'
-(
- ((comment) @_ecma_comment [
- (string (string_fragment) @injection.content)
- (template_string (string_fragment) @injection.content)
+(((comment) @_ecma_comment
+ [
+ (string
+ (string_fragment) @injection.content)
+ (template_string
+ (string_fragment) @injection.content)
])
(#match? @_ecma_comment "^\\/\\*\\s*(gql|graphql)\\s*\\*\\/")
- (#set! injection.language "graphql")
-)
+ (#set! injection.language "graphql"))
; '/* css */' or '/*css*/'
-(
- ((comment) @_ecma_comment [
- (string (string_fragment) @injection.content)
- (template_string (string_fragment) @injection.content)
+(((comment) @_ecma_comment
+ [
+ (string
+ (string_fragment) @injection.content)
+ (template_string
+ (string_fragment) @injection.content)
])
(#match? @_ecma_comment "^\\/\\*\\s*(css)\\s*\\*\\/")
- (#set! injection.language "css")
-)
+ (#set! injection.language "css"))
@@ -1,223 +1,269 @@
(internal_module
- "namespace" @context
- name: (_) @name) @item
+ "namespace" @context
+ name: (_) @name) @item
(enum_declaration
- "enum" @context
- name: (_) @name) @item
+ "enum" @context
+ name: (_) @name) @item
(function_declaration
- "async"? @context
- "function" @context
- name: (_) @name
- parameters: (formal_parameters
- "(" @context
- ")" @context)) @item
+ "async"? @context
+ "function" @context
+ name: (_) @name
+ parameters: (formal_parameters
+ "(" @context
+ ")" @context)) @item
(generator_function_declaration
- "async"? @context
- "function" @context
- "*" @context
- name: (_) @name
- parameters: (formal_parameters
- "(" @context
- ")" @context)) @item
+ "async"? @context
+ "function" @context
+ "*" @context
+ name: (_) @name
+ parameters: (formal_parameters
+ "(" @context
+ ")" @context)) @item
(interface_declaration
- "interface" @context
- name: (_) @name) @item
+ "interface" @context
+ name: (_) @name) @item
(program
- (export_statement
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (identifier) @name) @item)))
+ (export_statement
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (identifier) @name) @item)))
; Exported array destructuring
(program
- (export_statement
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (array_pattern
- [
- (identifier) @name @item
- (assignment_pattern left: (identifier) @name @item)
- (rest_pattern (identifier) @name @item)
- ])))))
+ (export_statement
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (array_pattern
+ [
+ (identifier) @name @item
+ (assignment_pattern
+ left: (identifier) @name @item)
+ (rest_pattern
+ (identifier) @name @item)
+ ])))))
; Exported object destructuring
(program
- (export_statement
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (object_pattern
- [(shorthand_property_identifier_pattern) @name @item
- (pair_pattern
- value: (identifier) @name @item)
- (pair_pattern
- value: (assignment_pattern left: (identifier) @name @item))
- (rest_pattern (identifier) @name @item)])))))
+ (export_statement
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (object_pattern
+ [
+ (shorthand_property_identifier_pattern) @name @item
+ (pair_pattern
+ value: (identifier) @name @item)
+ (pair_pattern
+ value: (assignment_pattern
+ left: (identifier) @name @item))
+ (rest_pattern
+ (identifier) @name @item)
+ ])))))
(program
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (identifier) @name) @item))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (identifier) @name) @item))
; Top-level array destructuring
(program
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (array_pattern
- [
- (identifier) @name @item
- (assignment_pattern left: (identifier) @name @item)
- (rest_pattern (identifier) @name @item)
- ]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (array_pattern
+ [
+ (identifier) @name @item
+ (assignment_pattern
+ left: (identifier) @name @item)
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
; Top-level object destructuring
(program
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (object_pattern
- [(shorthand_property_identifier_pattern) @name @item
- (pair_pattern
- value: (identifier) @name @item)
- (pair_pattern
- value: (assignment_pattern left: (identifier) @name @item))
- (rest_pattern (identifier) @name @item)]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (object_pattern
+ [
+ (shorthand_property_identifier_pattern) @name @item
+ (pair_pattern
+ value: (identifier) @name @item)
+ (pair_pattern
+ value: (assignment_pattern
+ left: (identifier) @name @item))
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
(class_declaration
- "class" @context
- name: (_) @name) @item
+ "class" @context
+ name: (_) @name) @item
; Method definitions in classes (not in object literals)
(class_body
- (method_definition
- [
- "get"
- "set"
- "async"
- "*"
- "readonly"
- "static"
- (override_modifier)
- (accessibility_modifier)
- ]* @context
- name: (_) @name
- parameters: (formal_parameters
- "(" @context
- ")" @context)) @item)
+ (method_definition
+ [
+ "get"
+ "set"
+ "async"
+ "*"
+ "readonly"
+ "static"
+ (override_modifier)
+ (accessibility_modifier)
+ ]* @context
+ name: (_) @name
+ parameters: (formal_parameters
+ "(" @context
+ ")" @context)) @item)
; Object literal methods
(variable_declarator
- value: (object
- (method_definition
- [
- "get"
- "set"
- "async"
- "*"
- ]* @context
- name: (_) @name
- parameters: (formal_parameters
- "(" @context
- ")" @context)) @item))
+ value: (object
+ (method_definition
+ [
+ "get"
+ "set"
+ "async"
+ "*"
+ ]* @context
+ name: (_) @name
+ parameters: (formal_parameters
+ "(" @context
+ ")" @context)) @item))
(public_field_definition
- [
- "declare"
- "readonly"
- "abstract"
- "static"
- (accessibility_modifier)
- ]* @context
- name: (_) @name) @item
+ [
+ "declare"
+ "readonly"
+ "abstract"
+ "static"
+ (accessibility_modifier)
+ ]* @context
+ name: (_) @name) @item
; Add support for (node:test, bun:test and Jest) runnable
-(
- (call_expression
- function: [
- (identifier) @_name
- (member_expression
- object: [
- (identifier) @_name
- (member_expression object: (identifier) @_name)
- ]
- )
- ] @context
- (#any-of? @_name "it" "test" "describe" "context" "suite")
- arguments: (
- arguments . [
- (string (string_fragment) @name)
- (identifier) @name
- ]
- )
- )
-) @item
+((call_expression
+ function: [
+ (identifier) @_name
+ (member_expression
+ object: [
+ (identifier) @_name
+ (member_expression
+ object: (identifier) @_name)
+ ])
+ ] @context
+ (#any-of? @_name "it" "test" "describe" "context" "suite")
+ arguments: (arguments
+ .
+ [
+ (string
+ (string_fragment) @name)
+ (identifier) @name
+ ]))) @item
; Add support for parameterized tests
-(
- (call_expression
- function: (call_expression
- function: (member_expression
- object: [(identifier) @_name (member_expression object: (identifier) @_name)]
- property: (property_identifier) @_property
- )
- (#any-of? @_name "it" "test" "describe" "context" "suite")
- (#eq? @_property "each")
- )
- arguments: (
- arguments . [
- (string (string_fragment) @name)
- (identifier) @name
- ]
- )
- )
-) @item
+((call_expression
+ function: (call_expression
+ function: (member_expression
+ object: [
+ (identifier) @_name
+ (member_expression
+ object: (identifier) @_name)
+ ]
+ property: (property_identifier) @_property)
+ (#any-of? @_name "it" "test" "describe" "context" "suite")
+ (#eq? @_property "each"))
+ arguments: (arguments
+ .
+ [
+ (string
+ (string_fragment) @name)
+ (identifier) @name
+ ]))) @item
; Object properties
(pair
- key: [
- (property_identifier) @name
- (string (string_fragment) @name)
- (number) @name
- (computed_property_name) @name
- ]) @item
+ key: [
+ (property_identifier) @name
+ (string
+ (string_fragment) @name)
+ (number) @name
+ (computed_property_name) @name
+ ]) @item
; Nested variables in function bodies
(statement_block
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (identifier) @name) @item))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (identifier) @name) @item))
; Nested array destructuring in functions
(statement_block
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (array_pattern
- [
- (identifier) @name @item
- (assignment_pattern left: (identifier) @name @item)
- (rest_pattern (identifier) @name @item)
- ]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (array_pattern
+ [
+ (identifier) @name @item
+ (assignment_pattern
+ left: (identifier) @name @item)
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
; Nested object destructuring in functions
(statement_block
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (object_pattern
- [(shorthand_property_identifier_pattern) @name @item
- (pair_pattern value: (identifier) @name @item)
- (pair_pattern value: (assignment_pattern left: (identifier) @name @item))
- (rest_pattern (identifier) @name @item)]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (object_pattern
+ [
+ (shorthand_property_identifier_pattern) @name @item
+ (pair_pattern
+ value: (identifier) @name @item)
+ (pair_pattern
+ value: (assignment_pattern
+ left: (identifier) @name @item))
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
(comment) @annotation
@@ -2,7 +2,8 @@
(string) @string
-(template_string (string_fragment) @string)
+(template_string
+ (string_fragment) @string)
(jsx_element) @element
@@ -1,46 +1,42 @@
; Add support for (node:test, bun:test and Jest) runnable
; Function expression that has `it`, `test` or `describe` as the function name
-(
- (call_expression
- function: [
- (identifier) @_name
- (member_expression
- object: [
- (identifier) @_name
- (member_expression object: (identifier) @_name)
- ]
- )
- ]
- (#any-of? @_name "it" "test" "describe" "context" "suite")
- arguments: (
- arguments . [
- (string (string_fragment) @run)
- (identifier) @run
- ]
- )
- ) @_js-test
-
- (#set! tag js-test)
-)
+((call_expression
+ function: [
+ (identifier) @_name
+ (member_expression
+ object: [
+ (identifier) @_name
+ (member_expression
+ object: (identifier) @_name)
+ ])
+ ]
+ (#any-of? @_name "it" "test" "describe" "context" "suite")
+ arguments: (arguments
+ .
+ [
+ (string
+ (string_fragment) @run)
+ (identifier) @run
+ ])) @_js-test
+ (#set! tag js-test))
; Add support for parameterized tests
-(
- (call_expression
- function: (call_expression
- function: (member_expression
- object: [(identifier) @_name (member_expression object: (identifier) @_name)]
- property: (property_identifier) @_property
- )
- (#any-of? @_name "it" "test" "describe" "context" "suite")
- (#eq? @_property "each")
- )
- arguments: (
- arguments . [
- (string (string_fragment) @run)
- (identifier) @run
- ]
- )
- ) @_js-test
-
- (#set! tag js-test)
-)
+((call_expression
+ function: (call_expression
+ function: (member_expression
+ object: [
+ (identifier) @_name
+ (member_expression
+ object: (identifier) @_name)
+ ]
+ property: (property_identifier) @_property)
+ (#any-of? @_name "it" "test" "describe" "context" "suite")
+ (#eq? @_property "each"))
+ arguments: (arguments
+ .
+ [
+ (string
+ (string_fragment) @run)
+ (identifier) @run
+ ])) @_js-test
+ (#set! tag js-test))
@@ -1,85 +1,91 @@
(comment)+ @comment.around
(function_declaration
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(method_definition
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(function_expression
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
((arrow_function
- body: (statement_block
- "{"
- (_)* @function.inside
- "}")) @function.around
- (#not-has-parent? @function.around variable_declarator))
+ body: (statement_block
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
+ (#not-has-parent? @function.around variable_declarator))
; Arrow function in variable declaration - capture the full declaration
([
- (lexical_declaration
- (variable_declarator
- value: (arrow_function
- body: (statement_block
- "{"
- (_)* @function.inside
- "}"))))
- (variable_declaration
- (variable_declarator
- value: (arrow_function
- body: (statement_block
- "{"
- (_)* @function.inside
- "}"))))
+ (lexical_declaration
+ (variable_declarator
+ value: (arrow_function
+ body: (statement_block
+ "{"
+ (_)* @function.inside
+ "}"))))
+ (variable_declaration
+ (variable_declarator
+ value: (arrow_function
+ body: (statement_block
+ "{"
+ (_)* @function.inside
+ "}"))))
]) @function.around
; Arrow function in variable declaration (captures body for expression-bodied arrows)
([
- (lexical_declaration
- (variable_declarator
- value: (arrow_function
- body: (_) @function.inside)))
- (variable_declaration
- (variable_declarator
- value: (arrow_function
- body: (_) @function.inside)))
+ (lexical_declaration
+ (variable_declarator
+ value: (arrow_function
+ body: (_) @function.inside)))
+ (variable_declaration
+ (variable_declarator
+ value: (arrow_function
+ body: (_) @function.inside)))
]) @function.around
; Catch-all for arrow functions in other contexts (callbacks, etc.)
((arrow_function
- body: (_) @function.inside) @function.around
- (#not-has-parent? @function.around variable_declarator))
+ body: (_) @function.inside) @function.around
+ (#not-has-parent? @function.around variable_declarator))
(generator_function
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(generator_function_declaration
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(class_declaration
- body: (_
- "{"
- [(_) ";"?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ";"?
+ ]* @class.inside
+ "}")) @class.around
(class
- body: (_
- "{"
- [(_) ";"?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ";"?
+ ]* @class.inside
+ "}")) @class.around
@@ -1,2 +1,5 @@
-("[" @open "]" @close)
-("{" @open "}" @close)
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
@@ -1,3 +1,5 @@
(tag_name) @keyword.jsdoc
+
(type) @type.jsdoc
+
(identifier) @variable.jsdoc
@@ -1,3 +1,9 @@
-("[" @open "]" @close)
-("{" @open "}" @close)
-(("\"" @open "\"" @close) (#set! rainbow.exclude))
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+(("\"" @open
+ "\"" @close)
+ (#set! rainbow.exclude))
@@ -1,6 +1,7 @@
(comment) @comment
(string) @string
+
(escape_sequence) @string.escape
(pair
@@ -1,2 +1,5 @@
-(array "]" @end) @indent
-(object "}" @end) @indent
+(array
+ "]" @end) @indent
+
+(object
+ "}" @end) @indent
@@ -1,2 +1,3 @@
(pair
- key: (string (string_content) @name)) @item
+ key: (string
+ (string_content) @name)) @item
@@ -1,4 +1,11 @@
-(pair value: (number) @redact)
-(pair value: (string) @redact)
-(array (number) @redact)
-(array (string) @redact)
+(pair
+ value: (number) @redact)
+
+(pair
+ value: (string) @redact)
+
+(array
+ (number) @redact)
+
+(array
+ (string) @redact)
@@ -1,21 +1,13 @@
; Add support `package.json` and `composer.json` script runnable
-
-(
- (document
- (object
- (pair
- key: (string
- (string_content) @_name
- (#eq? @_name "scripts")
- )
- value: (object
- (pair
- key: (string (string_content) @run @script)
- )
- )
- )
- )
- )
- (#set! tag package-script)
- (#set! tag composer-script)
-)
+((document
+ (object
+ (pair
+ key: (string
+ (string_content) @_name
+ (#eq? @_name "scripts"))
+ value: (object
+ (pair
+ key: (string
+ (string_content) @run @script))))))
+ (#set! tag package-script)
+ (#set! tag composer-script))
@@ -1,3 +1,9 @@
-("[" @open "]" @close)
-("{" @open "}" @close)
-(("\"" @open "\"" @close) (#set! rainbow.exclude))
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+(("\"" @open
+ "\"" @close)
+ (#set! rainbow.exclude))
@@ -1,6 +1,7 @@
(comment) @comment
(string) @string
+
(escape_sequence) @string.escape
(pair
@@ -1,2 +1,5 @@
-(array "]" @end) @indent
-(object "}" @end) @indent
+(array
+ "]" @end) @indent
+
+(object
+ "}" @end) @indent
@@ -1,2 +1,2 @@
((comment) @injection.content
- (#set! injection.language "comment"))
+ (#set! injection.language "comment"))
@@ -1,2 +1,3 @@
(pair
- key: (string (string_content) @name)) @item
+ key: (string
+ (string_content) @name)) @item
@@ -1,2 +1,3 @@
(comment) @comment.inclusive
+
(string) @string
@@ -1,4 +1,11 @@
-(pair value: (number) @redact)
-(pair value: (string) @redact)
-(array (number) @redact)
-(array (string) @redact)
+(pair
+ value: (number) @redact)
+
+(pair
+ value: (string) @redact)
+
+(array
+ (number) @redact)
+
+(array
+ (string) @redact)
@@ -1,6 +1,9 @@
(emphasis) @emphasis.markup
+
(strong_emphasis) @emphasis.strong.markup
+
(code_span) @text.literal.markup
+
(strikethrough) @strikethrough.markup
[
@@ -13,8 +16,18 @@
(link_label)
] @link_text.markup
-(inline_link ["(" ")"] @link_uri.markup)
-(image ["(" ")"] @link_uri.markup)
+(inline_link
+ [
+ "("
+ ")"
+ ] @link_uri.markup)
+
+(image
+ [
+ "("
+ ")"
+ ] @link_uri.markup)
+
[
(link_destination)
(uri_autolink)
@@ -1,7 +1,24 @@
-("(" @open ")" @close)
-("[" @open "]" @close)
-("{" @open "}" @close)
-(("\"" @open "\"" @close) (#set! rainbow.exclude))
-(("`" @open "`" @close) (#set! rainbow.exclude))
-(("'" @open "'" @close) (#set! rainbow.exclude))
-(((fenced_code_block_delimiter) @open (fenced_code_block_delimiter) @close) (#set! rainbow.exclude))
+("(" @open
+ ")" @close)
+
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+(("\"" @open
+ "\"" @close)
+ (#set! rainbow.exclude))
+
+(("`" @open
+ "`" @close)
+ (#set! rainbow.exclude))
+
+(("'" @open
+ "'" @close)
+ (#set! rainbow.exclude))
+
+(((fenced_code_block_delimiter) @open
+ (fenced_code_block_delimiter) @close)
+ (#set! rainbow.exclude))
@@ -9,7 +9,9 @@
(setext_heading)
(thematic_break)
] @title.markup
-(setext_heading (paragraph) @title.markup)
+
+(setext_heading
+ (paragraph) @title.markup)
[
(list_marker_plus)
@@ -20,10 +22,18 @@
] @punctuation.list_marker.markup
(block_quote_marker) @punctuation.markup
-(pipe_table_header "|" @punctuation.markup)
-(pipe_table_row "|" @punctuation.markup)
-(pipe_table_delimiter_row "|" @punctuation.markup)
-(pipe_table_delimiter_cell "-" @punctuation.markup)
+
+(pipe_table_header
+ "|" @punctuation.markup)
+
+(pipe_table_row
+ "|" @punctuation.markup)
+
+(pipe_table_delimiter_row
+ "|" @punctuation.markup)
+
+(pipe_table_delimiter_cell
+ "-" @punctuation.markup)
[
(fenced_code_block_delimiter)
@@ -31,4 +41,5 @@
] @punctuation.embedded.markup
(link_reference_definition) @link_text.markup
+
(link_destination) @link_uri.markup
@@ -1,3 +1,4 @@
-(list (list_item) @indent)
+(list
+ (list_item) @indent)
(list_item) @start.list_item
@@ -4,11 +4,13 @@
(code_fence_content) @injection.content)
((inline) @injection.content
- (#set! injection.language "markdown-inline"))
+ (#set! injection.language "markdown-inline"))
((html_block) @injection.content
(#set! injection.language "html"))
-((minus_metadata) @injection.content (#set! injection.language "yaml"))
+((minus_metadata) @injection.content
+ (#set! injection.language "yaml"))
-((plus_metadata) @injection.content (#set! injection.language "toml"))
+((plus_metadata) @injection.content
+ (#set! injection.language "toml"))
@@ -1,3 +1,6 @@
(section
- (atx_heading
- . (_) @context . (_) @name)) @item
+ (atx_heading
+ .
+ (_) @context
+ .
+ (_) @name)) @item
@@ -1,3 +1,3 @@
(section
- (atx_heading)
- (_)* @class.inside) @class.around
+ (atx_heading)
+ (_)* @class.inside) @class.around
@@ -1,4 +1,12 @@
-("(" @open ")" @close)
-("[" @open "]" @close)
-("{" @open "}" @close)
-(((string_start) @open (string_end) @close) (#set! rainbow.exclude))
+("(" @open
+ ")" @close)
+
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+(((string_start) @open
+ (string_end) @close)
+ (#set! rainbow.exclude))
@@ -1,43 +1,97 @@
(identifier) @debug-variable
(#eq? @debug-variable "self")
-(assignment left: (identifier) @debug-variable)
-(assignment left: (pattern_list (identifier) @debug-variable))
-(assignment left: (tuple_pattern (identifier) @debug-variable))
+(assignment
+ left: (identifier) @debug-variable)
-(augmented_assignment left: (identifier) @debug-variable)
+(assignment
+ left: (pattern_list
+ (identifier) @debug-variable))
-(for_statement left: (identifier) @debug-variable)
-(for_statement left: (pattern_list (identifier) @debug-variable))
-(for_statement left: (tuple_pattern (identifier) @debug-variable))
+(assignment
+ left: (tuple_pattern
+ (identifier) @debug-variable))
-(for_in_clause left: (identifier) @debug-variable)
-(for_in_clause left: (pattern_list (identifier) @debug-variable))
-(for_in_clause left: (tuple_pattern (identifier) @debug-variable))
+(augmented_assignment
+ left: (identifier) @debug-variable)
-(as_pattern (identifier) @debug-variable)
+(for_statement
+ left: (identifier) @debug-variable)
-(binary_operator left: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
-(binary_operator right: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
-(comparison_operator (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(for_statement
+ left: (pattern_list
+ (identifier) @debug-variable))
-(list (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
-(tuple (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
-(set (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(for_statement
+ left: (tuple_pattern
+ (identifier) @debug-variable))
-(subscript value: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(for_in_clause
+ left: (identifier) @debug-variable)
-(attribute object: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(for_in_clause
+ left: (pattern_list
+ (identifier) @debug-variable))
-(return_statement (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(for_in_clause
+ left: (tuple_pattern
+ (identifier) @debug-variable))
-(parenthesized_expression (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(as_pattern
+ (identifier) @debug-variable)
-(argument_list (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(binary_operator
+ left: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(if_statement condition: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(binary_operator
+ right: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(while_statement condition: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(comparison_operator
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(list
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(tuple
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(set
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(subscript
+ value: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(attribute
+ object: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(return_statement
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(parenthesized_expression
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(argument_list
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(if_statement
+ condition: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(while_statement
+ condition: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
(block) @debug-scope
+
(module) @debug-scope
@@ -1,6 +1,8 @@
; Identifier naming conventions; these "soft conventions" should stay at the top of the file as they're often overridden
(identifier) @variable
-(attribute attribute: (identifier) @property)
+
+(attribute
+ attribute: (identifier) @property)
; CamelCase for classes
((identifier) @type.class
@@ -10,45 +12,56 @@
((identifier) @constant
(#match? @constant "^_*[A-Z][A-Z0-9_]*$"))
-(type (identifier) @type)
-(generic_type (identifier) @type)
+(type
+ (identifier) @type)
+
+(generic_type
+ (identifier) @type)
+
(comment) @comment
+
(string) @string
+
(escape_sequence) @string.escape
; Type alias
-(type_alias_statement "type" @keyword)
+(type_alias_statement
+ "type" @keyword)
; TypeVar with constraints in type parameters
(type
- (tuple (identifier) @type)
-)
+ (tuple
+ (identifier) @type))
; Forward references
(type
- (string) @type
-)
-
+ (string) @type)
; Function calls
-
(call
- function: (attribute attribute: (identifier) @function.method.call))
+ function: (attribute
+ attribute: (identifier) @function.method.call))
+
(call
function: (identifier) @function.call)
-(decorator "@" @punctuation.special)
+(decorator
+ "@" @punctuation.special)
+
(decorator
"@" @punctuation.special
[
(identifier) @function.decorator
- (attribute attribute: (identifier) @function.decorator)
- (call function: (identifier) @function.decorator.call)
- (call (attribute attribute: (identifier) @function.decorator.call))
+ (attribute
+ attribute: (identifier) @function.decorator)
+ (call
+ function: (identifier) @function.decorator.call)
+ (call
+ (attribute
+ attribute: (identifier) @function.decorator.call))
])
; Function and class definitions
-
(function_definition
name: (identifier) @function.definition)
@@ -69,15 +82,15 @@
; Function arguments
(function_definition
parameters: (parameters
- [
- (identifier) @variable.parameter; Simple parameters
+ [
+ (identifier) @variable.parameter ; Simple parameters
(typed_parameter
(identifier) @variable.parameter) ; Typed parameters
(default_parameter
name: (identifier) @variable.parameter) ; Default parameters
(typed_default_parameter
name: (identifier) @variable.parameter) ; Typed default parameters
- ]))
+ ]))
; Keyword arguments
(call
@@ -86,28 +99,30 @@
name: (identifier) @function.kwargs)))
; Class definitions and calling: needs to come after the regex matching above
-
(class_definition
name: (identifier) @type.class.definition)
(class_definition
superclasses: (argument_list
- (identifier) @type.class.inheritance))
+ (identifier) @type.class.inheritance))
(call
function: (identifier) @type.class.call
(#match? @type.class.call "^_*[A-Z][A-Za-z0-9_]*$"))
; Builtins
-
((call
function: (identifier) @function.builtin)
- (#any-of?
- @function.builtin
- "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type" "vars" "zip" "__import__"))
+ (#any-of? @function.builtin
+ "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr"
+ "classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec"
+ "filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id"
+ "input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview"
+ "min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed"
+ "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type"
+ "vars" "zip" "__import__"))
; Literals
-
[
(true)
(false)
@@ -124,10 +139,11 @@
] @number
; Self references
-
[
- (parameters (identifier) @variable.special)
- (attribute (identifier) @variable.special)
+ (parameters
+ (identifier) @variable.special)
+ (attribute
+ (identifier) @variable.special)
(#any-of? @variable.special "self" "cls")
]
@@ -152,37 +168,57 @@
; Docstrings.
([
- (expression_statement (assignment))
+ (expression_statement
+ (assignment))
(type_alias_statement)
]
-. (expression_statement (string) @string.doc)+)
+ .
+ (expression_statement
+ (string) @string.doc)+)
(module
- .(expression_statement (string) @string.doc)+)
+ .
+ (expression_statement
+ (string) @string.doc)+)
(class_definition
- body: (block .(expression_statement (string) @string.doc)+))
+ body: (block
+ .
+ (expression_statement
+ (string) @string.doc)+))
(function_definition
"async"?
"def"
name: (_)
(parameters)?
- body: (block .(expression_statement (string) @string.doc)+))
+ body: (block
+ .
+ (expression_statement
+ (string) @string.doc)+))
(class_definition
body: (block
- . (comment) @comment*
- . (expression_statement (string) @string.doc)+))
+ .
+ (comment) @comment*
+ .
+ (expression_statement
+ (string) @string.doc)+))
(module
- . (comment) @comment*
- . (expression_statement (string) @string.doc)+)
+ .
+ (comment) @comment*
+ .
+ (expression_statement
+ (string) @string.doc)+)
(class_definition
body: (block
- (expression_statement (assignment))
- . (expression_statement (string) @string.doc)+))
+ (expression_statement
+ (assignment))
+ .
+ (expression_statement
+ (string) @string.doc)+))
(class_definition
body: (block
@@ -190,9 +226,11 @@
name: (identifier) @function.method.constructor
(#eq? @function.method.constructor "__init__")
body: (block
- (expression_statement (assignment))
- . (expression_statement (string) @string.doc)+))))
-
+ (expression_statement
+ (assignment))
+ .
+ (expression_statement
+ (string) @string.doc)+))))
[
"-"
@@ -286,18 +324,23 @@
"lambda"
] @keyword.definition
-(decorator (identifier) @attribute.builtin
+(decorator
+ (identifier) @attribute.builtin
(#any-of? @attribute.builtin "classmethod" "staticmethod" "property"))
; Builtin types as identifiers
[
(call
function: (identifier) @type.builtin)
- (type (identifier) @type.builtin)
- (generic_type (identifier) @type.builtin)
+ (type
+ (identifier) @type.builtin)
+ (generic_type
+ (identifier) @type.builtin)
; also check if type binary operator left identifier for union types
(type
(binary_operator
left: (identifier) @type.builtin))
- (#any-of? @type.builtin "bool" "bytearray" "bytes" "complex" "dict" "float" "frozenset" "int" "list" "memoryview" "object" "range" "set" "slice" "str" "tuple")
+ (#any-of? @type.builtin
+ "bool" "bytearray" "bytes" "complex" "dict" "float" "frozenset" "int" "list" "memoryview"
+ "object" "range" "set" "slice" "str" "tuple")
]
@@ -1,32 +1,38 @@
(import_statement
- name: [
- (dotted_name
- ((identifier) @namespace ".")*
- (identifier) @namespace .)
- (aliased_import
- name: (dotted_name
- ((identifier) @namespace ".")*
- (identifier) @namespace .))
- ]) @wildcard @import
+ name: [
+ (dotted_name
+ ((identifier) @namespace
+ ".")*
+ (identifier) @namespace .)
+ (aliased_import
+ name: (dotted_name
+ ((identifier) @namespace
+ ".")*
+ (identifier) @namespace .))
+ ]) @wildcard @import
(import_from_statement
- module_name: [
- (dotted_name
- ((identifier) @namespace ".")*
- (identifier) @namespace .)
- (relative_import
- (dotted_name
- ((identifier) @namespace ".")*
- (identifier) @namespace .)?)
- ]
- (wildcard_import)? @wildcard
- name: [
- (dotted_name
- ((identifier) @namespace ".")*
- (identifier) @name .)
- (aliased_import
- name: (dotted_name
- ((identifier) @namespace ".")*
- (identifier) @name .)
- alias: (identifier) @alias)
- ]?) @import
+ module_name: [
+ (dotted_name
+ ((identifier) @namespace
+ ".")*
+ (identifier) @namespace .)
+ (relative_import
+ (dotted_name
+ ((identifier) @namespace
+ ".")*
+ (identifier) @namespace .)?)
+ ]
+ (wildcard_import)? @wildcard
+ name: [
+ (dotted_name
+ ((identifier) @namespace
+ ".")*
+ (identifier) @name .)
+ (aliased_import
+ name: (dotted_name
+ ((identifier) @namespace
+ ".")*
+ (identifier) @name .)
+ alias: (identifier) @alias)
+ ]?) @import
@@ -1,17 +1,37 @@
-(_ "[" "]" @end) @indent
-(_ "{" "}" @end) @indent
-(_ "(" ")" @end) @indent
+(_
+ "["
+ "]" @end) @indent
+
+(_
+ "{"
+ "}" @end) @indent
+
+(_
+ "("
+ ")" @end) @indent
(function_definition) @start.def
+
(class_definition) @start.class
+
(if_statement) @start.if
+
(for_statement) @start.for
+
(while_statement) @start.while
+
(with_statement) @start.with
+
(match_statement) @start.match
+
(try_statement) @start.try
+
(elif_clause) @start.elif
+
(else_clause) @start.else
+
(except_clause) @start.except
+
(finally_clause) @start.finally
+
(case_clause) @start.case
@@ -1,11 +1,10 @@
(decorator) @annotation
(class_definition
- "class" @context
- name: (identifier) @name
- ) @item
+ "class" @context
+ name: (identifier) @name) @item
(function_definition
- "async"? @context
- "def" @context
- name: (_) @name) @item
+ "async"? @context
+ "def" @context
+ name: (_) @name) @item
@@ -1,2 +1,3 @@
(comment) @comment.inclusive
+
(string) @string
@@ -1,151 +1,108 @@
; subclasses of unittest.TestCase or TestCase
-(
- (class_definition
- name: (identifier) @run @_unittest_class_name
- superclasses: (argument_list
- [(identifier) @_superclass
- (attribute (identifier) @_superclass)]
- )
- (#eq? @_superclass "TestCase")
- ) @_python-unittest-class
- (#set! tag python-unittest-class)
- )
+((class_definition
+ name: (identifier) @run @_unittest_class_name
+ superclasses: (argument_list
+ [
+ (identifier) @_superclass
+ (attribute
+ (identifier) @_superclass)
+ ])
+ (#eq? @_superclass "TestCase")) @_python-unittest-class
+ (#set! tag python-unittest-class))
; test methods whose names start with `test` in a TestCase
-(
- (class_definition
- name: (identifier) @_unittest_class_name
- superclasses: (argument_list
- [(identifier) @_superclass
- (attribute (identifier) @_superclass)]
- )
- (#eq? @_superclass "TestCase")
- body: (block
- (function_definition
- name: (identifier) @run @_unittest_method_name
- (#match? @_unittest_method_name "^test.*")
- ) @_python-unittest-method
- (#set! tag python-unittest-method)
- )
- )
- )
+(class_definition
+ name: (identifier) @_unittest_class_name
+ superclasses: (argument_list
+ [
+ (identifier) @_superclass
+ (attribute
+ (identifier) @_superclass)
+ ])
+ (#eq? @_superclass "TestCase")
+ body: (block
+ (function_definition
+ name: (identifier) @run @_unittest_method_name
+ (#match? @_unittest_method_name "^test.*")) @_python-unittest-method
+ (#set! tag python-unittest-method)))
; pytest functions
-(
- (module
- (function_definition
- name: (identifier) @run @_pytest_method_name
- (#match? @_pytest_method_name "^test_")
- ) @_python-pytest-method
- )
- (#set! tag python-pytest-method)
- )
+((module
+ (function_definition
+ name: (identifier) @run @_pytest_method_name
+ (#match? @_pytest_method_name "^test_")) @_python-pytest-method)
+ (#set! tag python-pytest-method))
; decorated pytest functions
-(
- (module
- (decorated_definition
- (decorator)+ @_decorator
- definition: (function_definition
- name: (identifier) @run @_pytest_method_name
- (#match? @_pytest_method_name "^test_")
- )
- ) @_python-pytest-method
- )
- (#set! tag python-pytest-method)
- )
-
+((module
+ (decorated_definition
+ (decorator)+ @_decorator
+ definition: (function_definition
+ name: (identifier) @run @_pytest_method_name
+ (#match? @_pytest_method_name "^test_"))) @_python-pytest-method)
+ (#set! tag python-pytest-method))
; pytest classes
-(
- (module
- (class_definition
- name: (identifier) @run @_pytest_class_name
- (#match? @_pytest_class_name "^Test")
- )
- (#set! tag python-pytest-class)
- )
- )
-
+(module
+ (class_definition
+ name: (identifier) @run @_pytest_class_name
+ (#match? @_pytest_class_name "^Test"))
+ (#set! tag python-pytest-class))
; decorated pytest classes
-(
- (module
- (decorated_definition
- (decorator)+ @_decorator
- definition: (class_definition
- name: (identifier) @run @_pytest_class_name
- (#match? @_pytest_class_name "^Test")
- )
- )
- (#set! tag python-pytest-class)
- )
- )
-
+(module
+ (decorated_definition
+ (decorator)+ @_decorator
+ definition: (class_definition
+ name: (identifier) @run @_pytest_class_name
+ (#match? @_pytest_class_name "^Test")))
+ (#set! tag python-pytest-class))
; pytest class methods
-(
- (module
- (class_definition
- name: (identifier) @_pytest_class_name
- (#match? @_pytest_class_name "^Test")
- body: (block
- [(decorated_definition
- (decorator)+ @_decorator
- definition: (function_definition
- name: (identifier) @run @_pytest_method_name
- (#match? @_pytest_method_name "^test_")
- )
- )
- (function_definition
- name: (identifier) @run @_pytest_method_name
- (#match? @_pytest_method_name "^test")
- )
- ] @_python-pytest-method)
- (#set! tag python-pytest-method)
- )
- )
- )
+(module
+ (class_definition
+ name: (identifier) @_pytest_class_name
+ (#match? @_pytest_class_name "^Test")
+ body: (block
+ [
+ (decorated_definition
+ (decorator)+ @_decorator
+ definition: (function_definition
+ name: (identifier) @run @_pytest_method_name
+ (#match? @_pytest_method_name "^test_")))
+ (function_definition
+ name: (identifier) @run @_pytest_method_name
+ (#match? @_pytest_method_name "^test"))
+ ] @_python-pytest-method)
+ (#set! tag python-pytest-method)))
; decorated pytest class methods
-(
- (module
- (decorated_definition
+(module
+ (decorated_definition
+ (decorator)+ @_decorator
+ definition: (class_definition
+ name: (identifier) @_pytest_class_name
+ (#match? @_pytest_class_name "^Test")
+ body: (block
+ [
+ (decorated_definition
(decorator)+ @_decorator
- definition: (class_definition
- name: (identifier) @_pytest_class_name
- (#match? @_pytest_class_name "^Test")
- body: (block
- [(decorated_definition
- (decorator)+ @_decorator
- definition: (function_definition
- name: (identifier) @run @_pytest_method_name
- (#match? @_pytest_method_name "^test_")
- )
- )
- (function_definition
- name: (identifier) @run @_pytest_method_name
- (#match? @_pytest_method_name "^test")
- )
- ] @_python-pytest-method)
- (#set! tag python-pytest-method)
- )
- )
- )
- )
+ definition: (function_definition
+ name: (identifier) @run @_pytest_method_name
+ (#match? @_pytest_method_name "^test_")))
+ (function_definition
+ name: (identifier) @run @_pytest_method_name
+ (#match? @_pytest_method_name "^test"))
+ ] @_python-pytest-method)
+ (#set! tag python-pytest-method))))
; module main method
-(
- (module
- (if_statement
- condition: (comparison_operator
- (identifier) @run @_lhs
- operators: "=="
- (string) @_rhs
- )
- (#eq? @_lhs "__name__")
- (#match? @_rhs "^[\"']__main__[\"']$")
- (#set! tag python-module-main-method)
- )
- )
- )
+(module
+ (if_statement
+ condition: (comparison_operator
+ (identifier) @run @_lhs
+ operators: "=="
+ (string) @_rhs)
+ (#eq? @_lhs "__name__")
+ (#match? @_rhs "^[\"']__main__[\"']$")
+ (#set! tag python-module-main-method)))
@@ -1,3 +1,8 @@
-("(" @open ")" @close)
-("[" @open "]" @close)
-("{" @open "}" @close)
+("(" @open
+ ")" @close)
+
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
@@ -51,5 +51,6 @@
(character_class
[
"^" @operator.regex
- (class_range "-" @operator.regex)
+ (class_range
+ "-" @operator.regex)
])
@@ -1,7 +1,23 @@
-("(" @open ")" @close)
-("[" @open "]" @close)
-("{" @open "}" @close)
-("<" @open ">" @close)
-(closure_parameters "|" @open "|" @close)
-(("\"" @open "\"" @close) (#set! rainbow.exclude))
-(("'" @open "'" @close) (#set! rainbow.exclude))
+("(" @open
+ ")" @close)
+
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+("<" @open
+ ">" @close)
+
+(closure_parameters
+ "|" @open
+ "|" @close)
+
+(("\"" @open
+ "\"" @close)
+ (#set! rainbow.exclude))
+
+(("'" @open
+ "'" @close)
+ (#set! rainbow.exclude))
@@ -1,50 +1,85 @@
(metavariable) @debug-variable
-(parameter (identifier) @debug-variable)
+(parameter
+ (identifier) @debug-variable)
(self) @debug-variable
-(static_item (identifier) @debug-variable)
-(const_item (identifier) @debug-variable)
+(static_item
+ (identifier) @debug-variable)
-(let_declaration pattern: (identifier) @debug-variable)
+(const_item
+ (identifier) @debug-variable)
-(let_condition (identifier) @debug-variable)
+(let_declaration
+ pattern: (identifier) @debug-variable)
-(match_arm (identifier) @debug-variable)
+(let_condition
+ (identifier) @debug-variable)
-(for_expression (identifier) @debug-variable)
+(match_arm
+ (identifier) @debug-variable)
-(closure_parameters (identifier) @debug-variable)
+(for_expression
+ (identifier) @debug-variable)
-(assignment_expression (identifier) @debug-variable)
+(closure_parameters
+ (identifier) @debug-variable)
-(field_expression (identifier) @debug-variable)
+(assignment_expression
+ (identifier) @debug-variable)
-(binary_expression (identifier) @debug-variable
+(field_expression
+ (identifier) @debug-variable)
+
+(binary_expression
+ (identifier) @debug-variable
(#not-match? @debug-variable "^[A-Z]"))
-(reference_expression (identifier) @debug-variable
+(reference_expression
+ (identifier) @debug-variable
(#not-match? @debug-variable "^[A-Z]"))
-(array_expression (identifier) @debug-variable)
-(tuple_expression (identifier) @debug-variable)
-(return_expression (identifier) @debug-variable)
-(await_expression (identifier) @debug-variable)
-(try_expression (identifier) @debug-variable)
-(index_expression (identifier) @debug-variable)
-(range_expression (identifier) @debug-variable)
-(unary_expression (identifier) @debug-variable)
+(array_expression
+ (identifier) @debug-variable)
+
+(tuple_expression
+ (identifier) @debug-variable)
+
+(return_expression
+ (identifier) @debug-variable)
+
+(await_expression
+ (identifier) @debug-variable)
+
+(try_expression
+ (identifier) @debug-variable)
+
+(index_expression
+ (identifier) @debug-variable)
+
+(range_expression
+ (identifier) @debug-variable)
+
+(unary_expression
+ (identifier) @debug-variable)
+
+(if_expression
+ (identifier) @debug-variable)
-(if_expression (identifier) @debug-variable)
-(while_expression (identifier) @debug-variable)
+(while_expression
+ (identifier) @debug-variable)
-(parenthesized_expression (identifier) @debug-variable)
+(parenthesized_expression
+ (identifier) @debug-variable)
-(arguments (identifier) @debug-variable
+(arguments
+ (identifier) @debug-variable
(#not-match? @debug-variable "^[A-Z]"))
-(macro_invocation (token_tree (identifier) @debug-variable
- (#not-match? @debug-variable "^[A-Z]")))
+(macro_invocation
+ (token_tree
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]")))
(block) @debug-scope
@@ -1,17 +1,33 @@
(identifier) @variable
+
(metavariable) @variable
+
(type_identifier) @type
+
(fragment_specifier) @type
+
(primitive_type) @type.builtin
+
(self) @variable.special
+
(field_identifier) @property
+
(shorthand_field_identifier) @property
-(trait_item name: (type_identifier) @type.interface)
-(impl_item trait: (type_identifier) @type.interface)
-(abstract_type trait: (type_identifier) @type.interface)
-(dynamic_type trait: (type_identifier) @type.interface)
-(trait_bounds (type_identifier) @type.interface)
+(trait_item
+ name: (type_identifier) @type.interface)
+
+(impl_item
+ trait: (type_identifier) @type.interface)
+
+(abstract_type
+ trait: (type_identifier) @type.interface)
+
+(dynamic_type
+ trait: (type_identifier) @type.interface)
+
+(trait_bounds
+ (type_identifier) @type.interface)
(call_expression
function: [
@@ -31,8 +47,11 @@
field: (field_identifier) @function.method)
])
-(function_item name: (identifier) @function.definition)
-(function_signature_item name: (identifier) @function.definition)
+(function_item
+ name: (identifier) @function.definition)
+
+(function_signature_item
+ name: (identifier) @function.definition)
(macro_invocation
macro: [
@@ -48,17 +67,17 @@
name: (identifier) @function.special.definition)
; Identifier conventions
-
; Assume uppercase names are types/enum-constructors
((identifier) @type
- (#match? @type "^[A-Z]"))
+ (#match? @type "^[A-Z]"))
; Assume all-caps names are constants
((identifier) @constant
- (#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
+ (#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
; Ensure enum variants are highlighted correctly regardless of naming convention
-(enum_variant name: (identifier) @type)
+(enum_variant
+ name: (identifier) @type)
[
"("
@@ -81,9 +100,7 @@
"::"
] @punctuation.delimiter
-[
- "#"
-] @punctuation.special
+"#" @punctuation.special
[
"as"
@@ -131,7 +148,7 @@
] @keyword.control
(for_expression
- ("for" @keyword.control))
+ "for" @keyword.control)
[
(string_literal)
@@ -154,8 +171,10 @@
] @comment
[
- (line_comment (doc_comment))
- (block_comment (doc_comment))
+ (line_comment
+ (doc_comment))
+ (block_comment
+ (doc_comment))
] @comment.doc
[
@@ -198,25 +217,44 @@
] @operator
; Avoid highlighting these as operators when used in doc comments.
-(unary_expression "!" @operator)
+(unary_expression
+ "!" @operator)
+
operator: "/" @operator
(lifetime
"'" @lifetime
(identifier) @lifetime)
-(parameter (identifier) @variable.parameter)
-
-(attribute_item (attribute [
- (identifier) @attribute
- (scoped_identifier name: (identifier) @attribute)
- (token_tree (identifier) @attribute (#match? @attribute "^[a-z\\d_]*$"))
- (token_tree (identifier) @none "::" (#match? @none "^[a-z\\d_]*$"))
-]))
-
-(inner_attribute_item (attribute [
- (identifier) @attribute
- (scoped_identifier name: (identifier) @attribute)
- (token_tree (identifier) @attribute (#match? @attribute "^[a-z\\d_]*$"))
- (token_tree (identifier) @none "::" (#match? @none "^[a-z\\d_]*$"))
-]))
+(parameter
+ (identifier) @variable.parameter)
+
+(attribute_item
+ (attribute
+ [
+ (identifier) @attribute
+ (scoped_identifier
+ name: (identifier) @attribute)
+ (token_tree
+ (identifier) @attribute
+ (#match? @attribute "^[a-z\\d_]*$"))
+ (token_tree
+ (identifier) @none
+ "::"
+ (#match? @none "^[a-z\\d_]*$"))
+ ]))
+
+(inner_attribute_item
+ (attribute
+ [
+ (identifier) @attribute
+ (scoped_identifier
+ name: (identifier) @attribute)
+ (token_tree
+ (identifier) @attribute
+ (#match? @attribute "^[a-z\\d_]*$"))
+ (token_tree
+ (identifier) @none
+ "::"
+ (#match? @none "^[a-z\\d_]*$"))
+ ]))
@@ -1,27 +1,29 @@
(use_declaration) @import
(scoped_use_list
- path: (_) @namespace
- list: (_) @list)
+ path: (_) @namespace
+ list: (_) @list)
(scoped_identifier
- path: (_) @namespace
- name: (identifier) @name)
+ path: (_) @namespace
+ name: (identifier) @name)
-(use_list (identifier) @name)
+(use_list
+ (identifier) @name)
-(use_declaration (identifier) @name)
+(use_declaration
+ (identifier) @name)
(use_as_clause
- path: (scoped_identifier
- path: (_) @namespace
- name: (_) @name)
- alias: (_) @alias)
+ path: (scoped_identifier
+ path: (_) @namespace
+ name: (_) @name)
+ alias: (_) @alias)
(use_as_clause
- path: (identifier) @name
- alias: (_) @alias)
+ path: (identifier) @name
+ alias: (_) @alias)
(use_wildcard
- (_)? @namespace
- "*" @wildcard)
+ (_)? @namespace
+ "*" @wildcard)
@@ -1,14 +1,26 @@
[
- ((where_clause) _ @end)
- (field_expression)
- (call_expression)
- (assignment_expression)
- (let_declaration)
- (let_chain)
- (await_expression)
+ ((where_clause)
+ _ @end)
+ (field_expression)
+ (call_expression)
+ (assignment_expression)
+ (let_declaration)
+ (let_chain)
+ (await_expression)
] @indent
-(_ "[" "]" @end) @indent
-(_ "<" ">" @end) @indent
-(_ "{" "}" @end) @indent
-(_ "(" ")" @end) @indent
+(_
+ "["
+ "]" @end) @indent
+
+(_
+ "<"
+ ">" @end) @indent
+
+(_
+ "{"
+ "}" @end) @indent
+
+(_
+ "("
+ ")" @end) @indent
@@ -1,64 +1,67 @@
([
- (line_comment)
- (block_comment)
+ (line_comment)
+ (block_comment)
] @injection.content
- (#set! injection.language "comment"))
+ (#set! injection.language "comment"))
(macro_invocation
- macro: [
- ((identifier) @_macro_name)
- (scoped_identifier (identifier) @_macro_name .)
- ]
- (#not-any-of? @_macro_name "view" "html")
- (token_tree) @injection.content
- (#set! injection.language "rust"))
+ macro: [
+ (identifier) @_macro_name
+ (scoped_identifier
+ (identifier) @_macro_name .)
+ ]
+ (#not-any-of? @_macro_name "view" "html")
+ (token_tree) @injection.content
+ (#set! injection.language "rust"))
; we need a better way for the leptos extension to declare that
; it wants to inject inside of rust, instead of modifying the rust
; injections to support leptos injections
(macro_invocation
- macro: [
- ((identifier) @_macro_name)
- (scoped_identifier (identifier) @_macro_name .)
- ]
- (#any-of? @_macro_name "view" "html")
- (token_tree) @injection.content
- (#set! injection.language "rstml")
- )
+ macro: [
+ (identifier) @_macro_name
+ (scoped_identifier
+ (identifier) @_macro_name .)
+ ]
+ (#any-of? @_macro_name "view" "html")
+ (token_tree) @injection.content
+ (#set! injection.language "rstml"))
(macro_invocation
- macro: [
- ((identifier) @_macro_name)
- (scoped_identifier (identifier) @_macro_name .)
- ]
- (#any-of? @_macro_name "sql")
- (_) @injection.content
- (#set! injection.language "sql")
- )
+ macro: [
+ (identifier) @_macro_name
+ (scoped_identifier
+ (identifier) @_macro_name .)
+ ]
+ (#any-of? @_macro_name "sql")
+ (_) @injection.content
+ (#set! injection.language "sql"))
; lazy_regex
(macro_invocation
- macro: [
- ((identifier) @_macro_name)
- (scoped_identifier (identifier) @_macro_name .)
- ]
- (token_tree [
- (string_literal (string_content) @injection.content)
- (raw_string_literal (string_content) @injection.content)
+ macro: [
+ (identifier) @_macro_name
+ (scoped_identifier
+ (identifier) @_macro_name .)
+ ]
+ (token_tree
+ [
+ (string_literal
+ (string_content) @injection.content)
+ (raw_string_literal
+ (string_content) @injection.content)
])
- (#set! injection.language "regex")
- (#any-of? @_macro_name "regex" "bytes_regex")
-)
+ (#set! injection.language "regex")
+ (#any-of? @_macro_name "regex" "bytes_regex"))
(call_expression
- function: (scoped_identifier) @_fn_path
- arguments: (arguments
- [
- (string_literal (string_content) @injection.content)
- (raw_string_literal (string_content) @injection.content)
- ]
- )
-
- (#match? @_fn_path ".*Regex(Builder)?::new")
- (#set! injection.language "regex")
-)
+ function: (scoped_identifier) @_fn_path
+ arguments: (arguments
+ [
+ (string_literal
+ (string_content) @injection.content)
+ (raw_string_literal
+ (string_content) @injection.content)
+ ])
+ (#match? @_fn_path ".*Regex(Builder)?::new")
+ (#set! injection.language "regex"))
@@ -1,73 +1,81 @@
(attribute_item) @annotation
+
(line_comment) @annotation
(struct_item
- (visibility_modifier)? @context
- "struct" @context
- name: (_) @name) @item
+ (visibility_modifier)? @context
+ "struct" @context
+ name: (_) @name) @item
(enum_item
- (visibility_modifier)? @context
- "enum" @context
- name: (_) @name) @item
+ (visibility_modifier)? @context
+ "enum" @context
+ name: (_) @name) @item
(enum_variant
- (visibility_modifier)? @context
- name: (_) @name) @item
+ (visibility_modifier)? @context
+ name: (_) @name) @item
(impl_item
- "impl" @context
- trait: (_)? @name
- "for"? @context
- type: (_) @name
- body: (_ . "{" @open "}" @close .)) @item
+ "impl" @context
+ trait: (_)? @name
+ "for"? @context
+ type: (_) @name
+ body: (_
+ .
+ "{" @open
+ "}" @close .)) @item
(trait_item
- (visibility_modifier)? @context
- "trait" @context
- name: (_) @name) @item
+ (visibility_modifier)? @context
+ "trait" @context
+ name: (_) @name) @item
(function_item
- (visibility_modifier)? @context
- (function_modifiers)? @context
- "fn" @context
- name: (_) @name
- body: (_ . "{" @open "}" @close .)) @item
+ (visibility_modifier)? @context
+ (function_modifiers)? @context
+ "fn" @context
+ name: (_) @name
+ body: (_
+ .
+ "{" @open
+ "}" @close .)) @item
(function_signature_item
- (visibility_modifier)? @context
- (function_modifiers)? @context
- "fn" @context
- name: (_) @name) @item
+ (visibility_modifier)? @context
+ (function_modifiers)? @context
+ "fn" @context
+ name: (_) @name) @item
(macro_definition
- . "macro_rules!" @context
- name: (_) @name) @item
+ .
+ "macro_rules!" @context
+ name: (_) @name) @item
(mod_item
- (visibility_modifier)? @context
- "mod" @context
- name: (_) @name) @item
+ (visibility_modifier)? @context
+ "mod" @context
+ name: (_) @name) @item
(type_item
- (visibility_modifier)? @context
- "type" @context
- name: (_) @name) @item
+ (visibility_modifier)? @context
+ "type" @context
+ name: (_) @name) @item
(associated_type
- "type" @context
- name: (_) @name) @item
+ "type" @context
+ name: (_) @name) @item
(const_item
- (visibility_modifier)? @context
- "const" @context
- name: (_) @name) @item
+ (visibility_modifier)? @context
+ "const" @context
+ name: (_) @name) @item
(static_item
- (visibility_modifier)? @context
- "static" @context
- name: (_) @name) @item
+ (visibility_modifier)? @context
+ "static" @context
+ name: (_) @name) @item
(field_declaration
- (visibility_modifier)? @context
- name: (_) @name) @item
+ (visibility_modifier)? @context
+ name: (_) @name) @item
@@ -2,6 +2,7 @@
(string_literal)
(raw_string_literal)
] @string
+
[
(line_comment)
(block_comment)
@@ -1,92 +1,75 @@
; Rust mod test
-(
- (attribute_item (attribute
- (
- (identifier) @_attribute)
- arguments: (
- (token_tree (identifier) @_test)
- (#eq? @_test "test")
- )
- )
- (#eq? @_attribute "cfg")
- )
- .
- (mod_item
- name: (_) @run
- )
- (#set! tag rust-mod-test)
-)
+((attribute_item
+ (attribute
+ (identifier) @_attribute
+ arguments: ((token_tree
+ (identifier) @_test)
+ (#eq? @_test "test")))
+ (#eq? @_attribute "cfg"))
+ .
+ (mod_item
+ name: (_) @run)
+ (#set! tag rust-mod-test))
; Rust test
-(
- (
- (attribute_item (attribute
- [((identifier) @_attribute)
- (scoped_identifier (identifier) @_attribute)
- ])
- (#match? @_attribute "test")
- ) @_start
- .
- (attribute_item) *
- .
- [(line_comment) (block_comment)] *
- .
- (function_item
- name: (_) @run @_test_name
- body: _
- ) @_end
- )
- (#set! tag rust-test)
-)
+(((attribute_item
+ (attribute
+ [
+ (identifier) @_attribute
+ (scoped_identifier
+ (identifier) @_attribute)
+ ])
+ (#match? @_attribute "test")) @_start
+ .
+ (attribute_item)*
+ .
+ [
+ (line_comment)
+ (block_comment)
+ ]*
+ .
+ (function_item
+ name: (_) @run @_test_name
+ body: _) @_end)
+ (#set! tag rust-test))
; Rust doc test
-(
- (
- (line_comment) *
- (line_comment
- doc: (_) @_comment_content
- ) @_start @run
- (#match? @_comment_content "```")
- .
- (line_comment) *
- .
- (line_comment
- doc: (_) @_end_comment_content
- ) @_end_code_block
- (#match? @_end_comment_content "```")
- .
- (line_comment) *
- (attribute_item) *
- .
- [(function_item
- name: (_) @_doc_test_name
- body: _
- ) (function_signature_item
- name: (_) @_doc_test_name
- ) (struct_item
- name: (_) @_doc_test_name
- ) (enum_item
- name: (_) @_doc_test_name
- body: _
- ) (
- (attribute_item) ?
- (macro_definition
- name: (_) @_doc_test_name)
- ) (mod_item
- name: (_) @_doc_test_name
- )] @_end
- )
- (#set! tag rust-doc-test)
-)
+(((line_comment)*
+ (line_comment
+ doc: (_) @_comment_content) @_start @run
+ (#match? @_comment_content "```")
+ .
+ (line_comment)*
+ .
+ (line_comment
+ doc: (_) @_end_comment_content) @_end_code_block
+ (#match? @_end_comment_content "```")
+ .
+ (line_comment)*
+ (attribute_item)*
+ .
+ [
+ (function_item
+ name: (_) @_doc_test_name
+ body: _)
+ (function_signature_item
+ name: (_) @_doc_test_name)
+ (struct_item
+ name: (_) @_doc_test_name)
+ (enum_item
+ name: (_) @_doc_test_name
+ body: _)
+ ((attribute_item)?
+ (macro_definition
+ name: (_) @_doc_test_name))
+ (mod_item
+ name: (_) @_doc_test_name)
+ ] @_end)
+ (#set! tag rust-doc-test))
; Rust main function
-(
- (
- (function_item
- name: (_) @run
- body: _
- ) @_rust_main_function_end
- (#eq? @run "main")
- )
- (#set! tag rust-main)
-)
+(((function_item
+ name: (_) @run
+ body: _) @_rust_main_function_end
+ (#eq? @run "main"))
+ (#set! tag rust-main))
@@ -2,50 +2,73 @@
(function_signature_item) @function.around
(function_item
- body: (_
- "{"
- (_)* @function.inside
- "}" )) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
; classes
(struct_item
- body: (_
- ["{" "("]?
- [(_) ","?]* @class.inside
- ["}" ")"]? )) @class.around
+ body: (_
+ [
+ "{"
+ "("
+ ]?
+ [
+ (_)
+ ","?
+ ]* @class.inside
+ [
+ "}"
+ ")"
+ ]?)) @class.around
(enum_item
- body: (_
- "{"
- [(_) ","?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ","?
+ ]* @class.inside
+ "}")) @class.around
(union_item
- body: (_
- "{"
- [(_) ","?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ","?
+ ]* @class.inside
+ "}")) @class.around
(trait_item
- body: (_
- "{"
- [(_) ","?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ","?
+ ]* @class.inside
+ "}")) @class.around
(impl_item
- body: (_
- "{"
- [(_) ","?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ","?
+ ]* @class.inside
+ "}")) @class.around
(mod_item
- body: (_
- "{"
- [(_) ","?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ","?
+ ]* @class.inside
+ "}")) @class.around
; comments
-
(line_comment)+ @comment.around
(block_comment) @comment.around
@@ -1,11 +1,35 @@
-("(" @open ")" @close)
-("[" @open "]" @close)
-("{" @open "}" @close)
-("<" @open ">" @close)
-("<" @open "/>" @close)
-("</" @open ">" @close)
-(("\"" @open "\"" @close) (#set! rainbow.exclude))
-(("'" @open "'" @close) (#set! rainbow.exclude))
-(("`" @open "`" @close) (#set! rainbow.exclude))
-
-((jsx_element (jsx_opening_element) @open (jsx_closing_element) @close) (#set! newline.only) (#set! rainbow.exclude))
+("(" @open
+ ")" @close)
+
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+("<" @open
+ ">" @close)
+
+("<" @open
+ "/>" @close)
+
+("</" @open
+ ">" @close)
+
+(("\"" @open
+ "\"" @close)
+ (#set! rainbow.exclude))
+
+(("'" @open
+ "'" @close)
+ (#set! rainbow.exclude))
+
+(("`" @open
+ "`" @close)
+ (#set! rainbow.exclude))
+
+((jsx_element
+ (jsx_opening_element) @open
+ (jsx_closing_element) @close)
+ (#set! newline.only)
+ (#set! rainbow.exclude))
@@ -1,25 +1,55 @@
-(lexical_declaration (variable_declarator name: (identifier) @debug-variable))
+(lexical_declaration
+ (variable_declarator
+ name: (identifier) @debug-variable))
-(for_in_statement left: (identifier) @debug-variable)
-(for_statement initializer: (lexical_declaration (variable_declarator name: (identifier) @debug-variable)))
+(for_in_statement
+ left: (identifier) @debug-variable)
-(binary_expression left: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
-(binary_expression right: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(for_statement
+ initializer: (lexical_declaration
+ (variable_declarator
+ name: (identifier) @debug-variable)))
-(unary_expression argument: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
-(update_expression argument: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(binary_expression
+ left: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(return_statement (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(binary_expression
+ right: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(parenthesized_expression (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(unary_expression
+ argument: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(jsx_expression (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(update_expression
+ argument: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(array (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(return_statement
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(pair value: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(parenthesized_expression
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(member_expression object: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(jsx_expression
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(array
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(pair
+ value: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(member_expression
+ object: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
(statement_block) @debug-scope
+
(program) @debug-scope
@@ -1,56 +1,33 @@
; Variables
-
(identifier) @variable
(call_expression
function: (member_expression
object: (identifier) @type
- (#any-of?
- @type
- "Promise"
- "Array"
- "Object"
- "Map"
- "Set"
- "WeakMap"
- "WeakSet"
- "Date"
- "Error"
- "TypeError"
- "RangeError"
- "SyntaxError"
- "ReferenceError"
- "EvalError"
- "URIError"
- "RegExp"
- "Function"
- "Number"
- "String"
- "Boolean"
- "Symbol"
- "BigInt"
- "Proxy"
- "ArrayBuffer"
- "DataView"
- )
- )
-)
+ (#any-of? @type
+ "Promise" "Array" "Object" "Map" "Set" "WeakMap" "WeakSet" "Date" "Error" "TypeError"
+ "RangeError" "SyntaxError" "ReferenceError" "EvalError" "URIError" "RegExp" "Function"
+ "Number" "String" "Boolean" "Symbol" "BigInt" "Proxy" "ArrayBuffer" "DataView")))
; Properties
-
(property_identifier) @property
+
(shorthand_property_identifier) @property
+
(shorthand_property_identifier_pattern) @property
+
(private_property_identifier) @property
; Function and method calls
-
(call_expression
function: (identifier) @function)
(call_expression
function: (member_expression
- property: [(property_identifier) (private_property_identifier)] @function.method))
+ property: [
+ (property_identifier)
+ (private_property_identifier)
+ ] @function.method))
(new_expression
constructor: (identifier) @type)
@@ -59,36 +36,58 @@
module: (identifier) @type)
; Function and method definitions
-
(function_expression
name: (identifier) @function)
+
(function_declaration
name: (identifier) @function)
+
(method_definition
- name: [(property_identifier) (private_property_identifier)] @function.method)
+ name: [
+ (property_identifier)
+ (private_property_identifier)
+ ] @function.method)
+
(method_definition
- name: (property_identifier) @constructor
- (#eq? @constructor "constructor"))
+ name: (property_identifier) @constructor
+ (#eq? @constructor "constructor"))
(pair
- key: [(property_identifier) (private_property_identifier)] @function.method
- value: [(function_expression) (arrow_function)])
+ key: [
+ (property_identifier)
+ (private_property_identifier)
+ ] @function.method
+ value: [
+ (function_expression)
+ (arrow_function)
+ ])
(assignment_expression
left: (member_expression
- property: [(property_identifier) (private_property_identifier)] @function.method)
- right: [(function_expression) (arrow_function)])
+ property: [
+ (property_identifier)
+ (private_property_identifier)
+ ] @function.method)
+ right: [
+ (function_expression)
+ (arrow_function)
+ ])
(variable_declarator
name: (identifier) @function
- value: [(function_expression) (arrow_function)])
+ value: [
+ (function_expression)
+ (arrow_function)
+ ])
(assignment_expression
left: (identifier) @function
- right: [(function_expression) (arrow_function)])
+ right: [
+ (function_expression)
+ (arrow_function)
+ ])
; Parameters
-
(required_parameter
(identifier) @variable.parameter)
@@ -122,9 +121,10 @@
name: (identifier) @variable.parameter)
; Special identifiers
-
(type_annotation) @type
+
(type_identifier) @type
+
(predefined_type) @type.builtin
(type_alias_declaration
@@ -153,12 +153,12 @@
(identifier)
(shorthand_property_identifier)
(shorthand_property_identifier_pattern)
- ] @constant
- (#match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
+] @constant
+ (#match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
; Literals
-
(this) @variable.special
+
(super) @variable.special
[
@@ -182,11 +182,12 @@
(escape_sequence) @string.escape
(regex) @string.regex
+
(regex_flags) @keyword.operator.regex
+
(number) @number
; Tokens
-
[
";"
"?."
@@ -244,7 +245,8 @@
"..."
] @operator
-(regex "/" @string.regex)
+(regex
+ "/" @string.regex)
[
"("
@@ -253,14 +255,13 @@
"]"
"{"
"}"
-] @punctuation.bracket
+] @punctuation.bracket
(ternary_expression
[
"?"
":"
- ] @operator
-)
+ ] @operator)
; Keywords
[
@@ -334,7 +335,8 @@
"yield"
] @keyword.control
-(switch_default "default" @keyword.control)
+(switch_default
+ "default" @keyword.control)
(template_substitution
"${" @punctuation.special
@@ -352,31 +354,32 @@
"<" @punctuation.bracket
">" @punctuation.bracket)
-(decorator "@" @punctuation.special)
+(decorator
+ "@" @punctuation.special)
(union_type
- ("|") @punctuation.special)
+ "|" @punctuation.special)
(intersection_type
- ("&") @punctuation.special)
+ "&" @punctuation.special)
(type_annotation
- (":") @punctuation.special)
+ ":" @punctuation.special)
(index_signature
- (":") @punctuation.special)
+ ":" @punctuation.special)
(type_predicate_annotation
- (":") @punctuation.special)
+ ":" @punctuation.special)
(public_field_definition
- ("?") @punctuation.special)
+ "?" @punctuation.special)
(property_signature
- ("?") @punctuation.special)
+ "?" @punctuation.special)
(method_signature
- ("?") @punctuation.special)
+ "?" @punctuation.special)
(optional_parameter
([
@@ -384,44 +387,66 @@
":"
]) @punctuation.special)
-
-
(jsx_opening_element
[
(identifier) @type
(member_expression
object: (identifier) @type
- property: (property_identifier) @type
- )
- ]
-)
+ property: (property_identifier) @type)
+ ])
+
(jsx_closing_element
[
(identifier) @type
(member_expression
object: (identifier) @type
- property: (property_identifier) @type
- )
- ]
-)
+ property: (property_identifier) @type)
+ ])
+
(jsx_self_closing_element
[
(identifier) @type
(member_expression
object: (identifier) @type
- property: (property_identifier) @type
- )
- ]
-)
-
-(jsx_opening_element (identifier) @tag.jsx (#match? @tag.jsx "^[a-z][^.]*$"))
-(jsx_closing_element (identifier) @tag.jsx (#match? @tag.jsx "^[a-z][^.]*$"))
-(jsx_self_closing_element (identifier) @tag.jsx (#match? @tag.jsx "^[a-z][^.]*$"))
-
-(jsx_attribute (property_identifier) @attribute.jsx)
-(jsx_opening_element (["<" ">"]) @punctuation.bracket.jsx)
-(jsx_closing_element (["</" ">"]) @punctuation.bracket.jsx)
-(jsx_self_closing_element (["<" "/>"]) @punctuation.bracket.jsx)
-(jsx_attribute "=" @punctuation.delimiter.jsx)
+ property: (property_identifier) @type)
+ ])
+
+(jsx_opening_element
+ (identifier) @tag.jsx
+ (#match? @tag.jsx "^[a-z][^.]*$"))
+
+(jsx_closing_element
+ (identifier) @tag.jsx
+ (#match? @tag.jsx "^[a-z][^.]*$"))
+
+(jsx_self_closing_element
+ (identifier) @tag.jsx
+ (#match? @tag.jsx "^[a-z][^.]*$"))
+
+(jsx_attribute
+ (property_identifier) @attribute.jsx)
+
+(jsx_opening_element
+ ([
+ "<"
+ ">"
+ ]) @punctuation.bracket.jsx)
+
+(jsx_closing_element
+ ([
+ "</"
+ ">"
+ ]) @punctuation.bracket.jsx)
+
+(jsx_self_closing_element
+ ([
+ "<"
+ "/>"
+ ]) @punctuation.bracket.jsx)
+
+(jsx_attribute
+ "=" @punctuation.delimiter.jsx)
+
(jsx_text) @text.jsx
+
(html_character_reference) @string.special
@@ -1,14 +1,16 @@
(import_statement
- import_clause: (import_clause
- [
- (identifier) @name
- (named_imports
- (import_specifier
- name: (_) @name
- alias: (_)? @alias))
- ])
- source: (string (string_fragment) @source)) @import
+ import_clause: (import_clause
+ [
+ (identifier) @name
+ (named_imports
+ (import_specifier
+ name: (_) @name
+ alias: (_)? @alias))
+ ])
+ source: (string
+ (string_fragment) @source)) @import
(import_statement
- !import_clause
- source: (string (string_fragment) @source @wildcard)) @import
+ !import_clause
+ source: (string
+ (string_fragment) @source @wildcard)) @import
@@ -1,20 +1,32 @@
[
- (call_expression)
- (assignment_expression)
- (member_expression)
- (lexical_declaration)
- (variable_declaration)
- (assignment_expression)
- (if_statement)
- (for_statement)
+ (call_expression)
+ (assignment_expression)
+ (member_expression)
+ (lexical_declaration)
+ (variable_declaration)
+ (assignment_expression)
+ (if_statement)
+ (for_statement)
] @indent
-(_ "[" "]" @end) @indent
-(_ "<" ">" @end) @indent
-(_ "{" "}" @end) @indent
-(_ "(" ")" @end) @indent
+(_
+ "["
+ "]" @end) @indent
-(jsx_opening_element ">" @end) @indent
+(_
+ "<"
+ ">" @end) @indent
+
+(_
+ "{"
+ "}" @end) @indent
+
+(_
+ "("
+ ")" @end) @indent
+
+(jsx_opening_element
+ ">" @end) @indent
(jsx_element
(jsx_opening_element) @start
@@ -1,6 +1,5 @@
((comment) @injection.content
- (#set! injection.language "comment")
-)
+ (#set! injection.language "comment"))
(((comment) @_jsdoc_comment
(#match? @_jsdoc_comment "(?s)^/[*][*][^*].*[*]/$")) @injection.content
@@ -10,119 +9,137 @@
(#set! injection.language "regex"))
(call_expression
- function: (identifier) @_name (#eq? @_name "css")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "css"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "css")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "css")))
(call_expression
function: (member_expression
- object: (identifier) @_obj (#eq? @_obj "styled")
+ object: (identifier) @_obj
+ (#eq? @_obj "styled")
property: (property_identifier))
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "css"))
-)
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "css")))
(call_expression
function: (call_expression
- function: (identifier) @_name (#eq? @_name "styled"))
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "css"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "styled"))
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "css")))
(call_expression
- function: (identifier) @_name (#eq? @_name "html")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "html"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "html")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "html")))
(call_expression
- function: (identifier) @_name (#eq? @_name "js")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "javascript"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "js")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "javascript")))
(call_expression
- function: (identifier) @_name (#eq? @_name "json")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "json"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "json")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "json")))
(call_expression
- function: (identifier) @_name (#eq? @_name "sql")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "sql"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "sql")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "sql")))
(call_expression
- function: (identifier) @_name (#eq? @_name "ts")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "typescript"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "ts")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "typescript")))
(call_expression
- function: (identifier) @_name (#match? @_name "^ya?ml$")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "yaml"))
-)
+ function: (identifier) @_name
+ (#match? @_name "^ya?ml$")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "yaml")))
(call_expression
- function: (identifier) @_name (#match? @_name "^g(raph)?ql$")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "graphql"))
-)
+ function: (identifier) @_name
+ (#match? @_name "^g(raph)?ql$")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "graphql")))
(call_expression
- function: (identifier) @_name (#match? @_name "^g(raph)?ql$")
- arguments: (arguments (template_string (string_fragment) @injection.content
- (#set! injection.language "graphql")))
-)
+ function: (identifier) @_name
+ (#match? @_name "^g(raph)?ql$")
+ arguments: (arguments
+ (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "graphql"))))
(call_expression
- function: (identifier) @_name(#match? @_name "^iso$")
- arguments: (arguments (template_string (string_fragment) @injection.content
- (#set! injection.language "isograph")))
-)
+ function: (identifier) @_name
+ (#match? @_name "^iso$")
+ arguments: (arguments
+ (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "isograph"))))
; Parse the contents of strings and tagged template
; literals with leading ECMAScript comments:
; '/* html */' or '/*html*/'
-(
- ((comment) @_ecma_comment [
- (string (string_fragment) @injection.content)
- (template_string (string_fragment) @injection.content)
+(((comment) @_ecma_comment
+ [
+ (string
+ (string_fragment) @injection.content)
+ (template_string
+ (string_fragment) @injection.content)
])
(#match? @_ecma_comment "^\\/\\*\\s*html\\s*\\*\\/")
- (#set! injection.language "html")
-)
+ (#set! injection.language "html"))
; '/* sql */' or '/*sql*/'
-(
- ((comment) @_ecma_comment [
- (string (string_fragment) @injection.content)
- (template_string (string_fragment) @injection.content)
+(((comment) @_ecma_comment
+ [
+ (string
+ (string_fragment) @injection.content)
+ (template_string
+ (string_fragment) @injection.content)
])
(#match? @_ecma_comment "^\\/\\*\\s*sql\\s*\\*\\/")
- (#set! injection.language "sql")
-)
+ (#set! injection.language "sql"))
; '/* gql */' or '/*gql*/'
; '/* graphql */' or '/*graphql*/'
-(
- ((comment) @_ecma_comment [
- (string (string_fragment) @injection.content)
- (template_string (string_fragment) @injection.content)
+(((comment) @_ecma_comment
+ [
+ (string
+ (string_fragment) @injection.content)
+ (template_string
+ (string_fragment) @injection.content)
])
(#match? @_ecma_comment "^\\/\\*\\s*(gql|graphql)\\s*\\*\\/")
- (#set! injection.language "graphql")
-)
+ (#set! injection.language "graphql"))
; '/* css */' or '/*css*/'
-(
- ((comment) @_ecma_comment [
- (string (string_fragment) @injection.content)
- (template_string (string_fragment) @injection.content)
+(((comment) @_ecma_comment
+ [
+ (string
+ (string_fragment) @injection.content)
+ (template_string
+ (string_fragment) @injection.content)
])
(#match? @_ecma_comment "^\\/\\*\\s*(css)\\s*\\*\\/")
- (#set! injection.language "css")
-)
+ (#set! injection.language "css"))
@@ -1,230 +1,275 @@
(internal_module
- "namespace" @context
- name: (_) @name) @item
+ "namespace" @context
+ name: (_) @name) @item
(enum_declaration
- "enum" @context
- name: (_) @name) @item
+ "enum" @context
+ name: (_) @name) @item
(type_alias_declaration
- "type" @context
- name: (_) @name) @item
+ "type" @context
+ name: (_) @name) @item
(function_declaration
- "async"? @context
- "function" @context
- name: (_) @name
- parameters: (formal_parameters
- "(" @context
- ")" @context)) @item
+ "async"? @context
+ "function" @context
+ name: (_) @name
+ parameters: (formal_parameters
+ "(" @context
+ ")" @context)) @item
(generator_function_declaration
- "async"? @context
- "function" @context
- "*" @context
- name: (_) @name
- parameters: (formal_parameters
- "(" @context
- ")" @context)) @item
+ "async"? @context
+ "function" @context
+ "*" @context
+ name: (_) @name
+ parameters: (formal_parameters
+ "(" @context
+ ")" @context)) @item
(interface_declaration
- "interface" @context
- name: (_) @name) @item
+ "interface" @context
+ name: (_) @name) @item
(export_statement
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (identifier) @name) @item))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (identifier) @name) @item))
; Exported array destructuring
(export_statement
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (array_pattern
- [
- (identifier) @name @item
- (assignment_pattern left: (identifier) @name @item)
- (rest_pattern (identifier) @name @item)
- ]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (array_pattern
+ [
+ (identifier) @name @item
+ (assignment_pattern
+ left: (identifier) @name @item)
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
; Exported object destructuring
(export_statement
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (object_pattern
- [(shorthand_property_identifier_pattern) @name @item
- (pair_pattern
- value: (identifier) @name @item)
- (pair_pattern
- value: (assignment_pattern left: (identifier) @name @item))
- (rest_pattern (identifier) @name @item)]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (object_pattern
+ [
+ (shorthand_property_identifier_pattern) @name @item
+ (pair_pattern
+ value: (identifier) @name @item)
+ (pair_pattern
+ value: (assignment_pattern
+ left: (identifier) @name @item))
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
(program
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (identifier) @name) @item))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (identifier) @name) @item))
; Top-level array destructuring
(program
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (array_pattern
- [
- (identifier) @name @item
- (assignment_pattern left: (identifier) @name @item)
- (rest_pattern (identifier) @name @item)
- ]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (array_pattern
+ [
+ (identifier) @name @item
+ (assignment_pattern
+ left: (identifier) @name @item)
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
; Top-level object destructuring
(program
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (object_pattern
- [(shorthand_property_identifier_pattern) @name @item
- (pair_pattern
- value: (identifier) @name @item)
- (pair_pattern
- value: (assignment_pattern left: (identifier) @name @item))
- (rest_pattern (identifier) @name @item)]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (object_pattern
+ [
+ (shorthand_property_identifier_pattern) @name @item
+ (pair_pattern
+ value: (identifier) @name @item)
+ (pair_pattern
+ value: (assignment_pattern
+ left: (identifier) @name @item))
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
(class_declaration
- "class" @context
- name: (_) @name) @item
+ "class" @context
+ name: (_) @name) @item
(abstract_class_declaration
- "abstract" @context
- "class" @context
- name: (_) @name) @item
+ "abstract" @context
+ "class" @context
+ name: (_) @name) @item
; Method definitions in classes (not in object literals)
(class_body
- (method_definition
- [
- "get"
- "set"
- "async"
- "*"
- "readonly"
- "static"
- (override_modifier)
- (accessibility_modifier)
- ]* @context
- name: (_) @name
- parameters: (formal_parameters
- "(" @context
- ")" @context)) @item)
+ (method_definition
+ [
+ "get"
+ "set"
+ "async"
+ "*"
+ "readonly"
+ "static"
+ (override_modifier)
+ (accessibility_modifier)
+ ]* @context
+ name: (_) @name
+ parameters: (formal_parameters
+ "(" @context
+ ")" @context)) @item)
; Object literal methods
(variable_declarator
- value: (object
- (method_definition
- [
- "get"
- "set"
- "async"
- "*"
- ]* @context
- name: (_) @name
- parameters: (formal_parameters
- "(" @context
- ")" @context)) @item))
+ value: (object
+ (method_definition
+ [
+ "get"
+ "set"
+ "async"
+ "*"
+ ]* @context
+ name: (_) @name
+ parameters: (formal_parameters
+ "(" @context
+ ")" @context)) @item))
(public_field_definition
- [
- "declare"
- "readonly"
- "abstract"
- "static"
- (accessibility_modifier)
- ]* @context
- name: (_) @name) @item
+ [
+ "declare"
+ "readonly"
+ "abstract"
+ "static"
+ (accessibility_modifier)
+ ]* @context
+ name: (_) @name) @item
; Add support for (node:test, bun:test and Jest) runnable
-(
- (call_expression
- function: [
- (identifier) @_name
- (member_expression
- object: [
- (identifier) @_name
- (member_expression object: (identifier) @_name)
- ]
- )
- ] @context
- (#any-of? @_name "it" "test" "describe" "context" "suite")
- arguments: (
- arguments . [
- (string (string_fragment) @name)
- (identifier) @name
- ]
- )
- )
-) @item
+((call_expression
+ function: [
+ (identifier) @_name
+ (member_expression
+ object: [
+ (identifier) @_name
+ (member_expression
+ object: (identifier) @_name)
+ ])
+ ] @context
+ (#any-of? @_name "it" "test" "describe" "context" "suite")
+ arguments: (arguments
+ .
+ [
+ (string
+ (string_fragment) @name)
+ (identifier) @name
+ ]))) @item
; Add support for parameterized tests
-(
- (call_expression
- function: (call_expression
- function: (member_expression
- object: [(identifier) @_name (member_expression object: (identifier) @_name)]
- property: (property_identifier) @_property
- )
- (#any-of? @_name "it" "test" "describe" "context" "suite")
- (#any-of? @_property "each")
- )
- arguments: (
- arguments . [
- (string (string_fragment) @name)
- (identifier) @name
- ]
- )
- )
-) @item
+((call_expression
+ function: (call_expression
+ function: (member_expression
+ object: [
+ (identifier) @_name
+ (member_expression
+ object: (identifier) @_name)
+ ]
+ property: (property_identifier) @_property)
+ (#any-of? @_name "it" "test" "describe" "context" "suite")
+ (#any-of? @_property "each"))
+ arguments: (arguments
+ .
+ [
+ (string
+ (string_fragment) @name)
+ (identifier) @name
+ ]))) @item
; Object properties
(pair
- key: [
- (property_identifier) @name
- (string (string_fragment) @name)
- (number) @name
- (computed_property_name) @name
- ]) @item
-
+ key: [
+ (property_identifier) @name
+ (string
+ (string_fragment) @name)
+ (number) @name
+ (computed_property_name) @name
+ ]) @item
; Nested variables in function bodies
(statement_block
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (identifier) @name) @item))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (identifier) @name) @item))
; Nested array destructuring in functions
(statement_block
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (array_pattern
- [
- (identifier) @name @item
- (assignment_pattern left: (identifier) @name @item)
- (rest_pattern (identifier) @name @item)
- ]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (array_pattern
+ [
+ (identifier) @name @item
+ (assignment_pattern
+ left: (identifier) @name @item)
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
; Nested object destructuring in functions
(statement_block
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (object_pattern
- [(shorthand_property_identifier_pattern) @name @item
- (pair_pattern value: (identifier) @name @item)
- (pair_pattern value: (assignment_pattern left: (identifier) @name @item))
- (rest_pattern (identifier) @name @item)]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (object_pattern
+ [
+ (shorthand_property_identifier_pattern) @name @item
+ (pair_pattern
+ value: (identifier) @name @item)
+ (pair_pattern
+ value: (assignment_pattern
+ left: (identifier) @name @item))
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
(comment) @annotation
@@ -2,7 +2,8 @@
(string) @string
-(template_string (string_fragment) @string)
+(template_string
+ (string_fragment) @string)
(jsx_element) @element
@@ -13,6 +14,7 @@
(jsx_expression)
] @default
-(_ value: (call_expression
- function: (identifier) @function_name_before_type_arguments
- type_arguments: (type_arguments)))
+(_
+ value: (call_expression
+ function: (identifier) @function_name_before_type_arguments
+ type_arguments: (type_arguments)))
@@ -1,46 +1,42 @@
; Add support for (node:test, bun:test and Jest) runnable
; Function expression that has `it`, `test` or `describe` as the function name
-(
- (call_expression
- function: [
- (identifier) @_name
- (member_expression
- object: [
- (identifier) @_name
- (member_expression object: (identifier) @_name)
- ]
- )
- ]
- (#any-of? @_name "it" "test" "describe" "context" "suite")
- arguments: (
- arguments . [
- (string (string_fragment) @run)
- (identifier) @run
- ]
- )
- ) @_js-test
-
- (#set! tag js-test)
-)
+((call_expression
+ function: [
+ (identifier) @_name
+ (member_expression
+ object: [
+ (identifier) @_name
+ (member_expression
+ object: (identifier) @_name)
+ ])
+ ]
+ (#any-of? @_name "it" "test" "describe" "context" "suite")
+ arguments: (arguments
+ .
+ [
+ (string
+ (string_fragment) @run)
+ (identifier) @run
+ ])) @_js-test
+ (#set! tag js-test))
; Add support for parameterized tests
-(
- (call_expression
- function: (call_expression
- function: (member_expression
- object: [(identifier) @_name (member_expression object: (identifier) @_name)]
- property: (property_identifier) @_property
- )
- (#any-of? @_name "it" "test" "describe" "context" "suite")
- (#any-of? @_property "each")
- )
- arguments: (
- arguments . [
- (string (string_fragment) @run)
- (identifier) @run
- ]
- )
- ) @_js-test
-
- (#set! tag js-test)
-)
+((call_expression
+ function: (call_expression
+ function: (member_expression
+ object: [
+ (identifier) @_name
+ (member_expression
+ object: (identifier) @_name)
+ ]
+ property: (property_identifier) @_property)
+ (#any-of? @_name "it" "test" "describe" "context" "suite")
+ (#any-of? @_property "each"))
+ arguments: (arguments
+ .
+ [
+ (string
+ (string_fragment) @run)
+ (identifier) @run
+ ])) @_js-test
+ (#set! tag js-test))
@@ -1,113 +1,129 @@
(comment)+ @comment.around
(function_declaration
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(method_definition
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(function_expression
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
((arrow_function
- body: (statement_block
- "{"
- (_)* @function.inside
- "}")) @function.around
- (#not-has-parent? @function.around variable_declarator))
+ body: (statement_block
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
+ (#not-has-parent? @function.around variable_declarator))
; Arrow function in variable declaration - capture the full declaration
([
- (lexical_declaration
- (variable_declarator
- value: (arrow_function
- body: (statement_block
- "{"
- (_)* @function.inside
- "}"))))
- (variable_declaration
- (variable_declarator
- value: (arrow_function
- body: (statement_block
- "{"
- (_)* @function.inside
- "}"))))
+ (lexical_declaration
+ (variable_declarator
+ value: (arrow_function
+ body: (statement_block
+ "{"
+ (_)* @function.inside
+ "}"))))
+ (variable_declaration
+ (variable_declarator
+ value: (arrow_function
+ body: (statement_block
+ "{"
+ (_)* @function.inside
+ "}"))))
]) @function.around
; Arrow function in variable declaration (expression body fallback)
([
- (lexical_declaration
- (variable_declarator
- value: (arrow_function
- body: (_) @function.inside)))
- (variable_declaration
- (variable_declarator
- value: (arrow_function
- body: (_) @function.inside)))
+ (lexical_declaration
+ (variable_declarator
+ value: (arrow_function
+ body: (_) @function.inside)))
+ (variable_declaration
+ (variable_declarator
+ value: (arrow_function
+ body: (_) @function.inside)))
]) @function.around
; Catch-all for arrow functions in other contexts (callbacks, etc.)
((arrow_function
- body: (_) @function.inside) @function.around
- (#not-has-parent? @function.around variable_declarator))
+ body: (_) @function.inside) @function.around
+ (#not-has-parent? @function.around variable_declarator))
+
(function_signature) @function.around
(generator_function
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(generator_function_declaration
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(class_declaration
- body: (_
- "{"
- [(_) ";"?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ";"?
+ ]* @class.inside
+ "}")) @class.around
(class
- body: (_
- "{"
- (_)* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ (_)* @class.inside
+ "}")) @class.around
(interface_declaration
- body: (_
- "{"
- [(_) ";"?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ";"?
+ ]* @class.inside
+ "}")) @class.around
(enum_declaration
- body: (_
- "{"
- [(_) ","?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ","?
+ ]* @class.inside
+ "}")) @class.around
(ambient_declaration
- (module
+ (module
body: (_
- "{"
- [(_) ";"?]* @class.inside
- "}" ))) @class.around
+ "{"
+ [
+ (_)
+ ";"?
+ ]* @class.inside
+ "}"))) @class.around
(internal_module
- body: (_
- "{"
- [(_) ";"?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ";"?
+ ]* @class.inside
+ "}")) @class.around
(type_alias_declaration) @class.around
@@ -1,7 +1,23 @@
-("(" @open ")" @close)
-("[" @open "]" @close)
-("{" @open "}" @close)
-("<" @open ">" @close)
-(("\"" @open "\"" @close) (#set! rainbow.exclude))
-(("'" @open "'" @close) (#set! rainbow.exclude))
-(("`" @open "`" @close) (#set! rainbow.exclude))
+("(" @open
+ ")" @close)
+
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+("<" @open
+ ">" @close)
+
+(("\"" @open
+ "\"" @close)
+ (#set! rainbow.exclude))
+
+(("'" @open
+ "'" @close)
+ (#set! rainbow.exclude))
+
+(("`" @open
+ "`" @close)
+ (#set! rainbow.exclude))
@@ -1,23 +1,51 @@
-(lexical_declaration (variable_declarator name: (identifier) @debug-variable))
+(lexical_declaration
+ (variable_declarator
+ name: (identifier) @debug-variable))
-(for_in_statement left: (identifier) @debug-variable)
-(for_statement initializer: (lexical_declaration (variable_declarator name: (identifier) @debug-variable)))
+(for_in_statement
+ left: (identifier) @debug-variable)
-(binary_expression left: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
-(binary_expression right: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(for_statement
+ initializer: (lexical_declaration
+ (variable_declarator
+ name: (identifier) @debug-variable)))
-(unary_expression argument: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
-(update_expression argument: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(binary_expression
+ left: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(return_statement (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(binary_expression
+ right: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(parenthesized_expression (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(unary_expression
+ argument: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(array (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(update_expression
+ argument: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(pair value: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(return_statement
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
-(member_expression object: (identifier) @debug-variable (#not-match? @debug-variable "^[A-Z]"))
+(parenthesized_expression
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(array
+ (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(pair
+ value: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
+
+(member_expression
+ object: (identifier) @debug-variable
+ (#not-match? @debug-variable "^[A-Z]"))
(statement_block) @debug-scope
+
(program) @debug-scope
@@ -1,46 +1,19 @@
; Variables
-
(identifier) @variable
(call_expression
function: (member_expression
object: (identifier) @type
- (#any-of?
- @type
- "Promise"
- "Array"
- "Object"
- "Map"
- "Set"
- "WeakMap"
- "WeakSet"
- "Date"
- "Error"
- "TypeError"
- "RangeError"
- "SyntaxError"
- "ReferenceError"
- "EvalError"
- "URIError"
- "RegExp"
- "Function"
- "Number"
- "String"
- "Boolean"
- "Symbol"
- "BigInt"
- "Proxy"
- "ArrayBuffer"
- "DataView"
- )
- )
-)
+ (#any-of? @type
+ "Promise" "Array" "Object" "Map" "Set" "WeakMap" "WeakSet" "Date" "Error" "TypeError"
+ "RangeError" "SyntaxError" "ReferenceError" "EvalError" "URIError" "RegExp" "Function"
+ "Number" "String" "Boolean" "Symbol" "BigInt" "Proxy" "ArrayBuffer" "DataView")))
; Special identifiers
-
(type_annotation) @type
(type_identifier) @type
+
(predefined_type) @type.builtin
(type_alias_declaration
@@ -65,49 +38,47 @@
(implements_clause
(type_identifier) @type)
-;; Enables ts-pretty-errors
-;; The Lsp returns "snippets" of typescript, which are not valid typescript in totality,
-;; but should still be highlighted
-;; Highlights object literals by hijacking the statement_block pattern, but only if
-;; the statement block follows an object literal pattern
-((statement_block
- (labeled_statement
- ;; highlight the label like a property name
- label: (statement_identifier) @property.name
- body: [
- ;; match a terminating expression statement
- (expression_statement
- ;; single identifier - treat as a type name
- [(identifier) @type.name
- ;; object - treat as a property - type pair
- (object
- (pair
- key: (_) @property.name
- value: (_) @type.name))
- ;; subscript_expression - treat as an array declaration
- (subscript_expression
- object: (_) @type.name
- index: (_)
- )
- ;; templated string - treat each identifier contained as a type name
- (template_string
- (template_substitution
- (identifier) @type.name))
- ])
- ;; match a nested statement block
- (statement_block) @nested
- ])))
+; Enables ts-pretty-errors
+; The Lsp returns "snippets" of typescript, which are not valid typescript in totality,
+; but should still be highlighted
+; Highlights object literals by hijacking the statement_block pattern, but only if
+; the statement block follows an object literal pattern
+(statement_block
+ (labeled_statement
+ ; highlight the label like a property name
+ label: (statement_identifier) @property.name
+ body: [
+ ; match a terminating expression statement
+ (expression_statement
+ ; single identifier - treat as a type name
+ [
+ (identifier) @type.name
+ ; object - treat as a property - type pair
+ (object
+ (pair
+ key: (_) @property.name
+ value: (_) @type.name))
+ ; subscript_expression - treat as an array declaration
+ (subscript_expression
+ object: (_) @type.name
+ index: (_))
+ ; templated string - treat each identifier contained as a type name
+ (template_string
+ (template_substitution
+ (identifier) @type.name))
+ ])
+ ; match a nested statement block
+ (statement_block) @nested
+ ]))
; Inline type imports: import { type Foo } or import { type Foo as Bar }
(import_specifier
"type"
- name: (identifier) @type
-)
+ name: (identifier) @type)
(import_specifier
"type"
- alias: (identifier) @type
-)
+ alias: (identifier) @type)
; Full type imports: import type { Foo } or import type { Foo as Bar }
(import_statement
@@ -115,45 +86,41 @@
(import_clause
(named_imports
(import_specifier
- name: (identifier) @type
- )
- )
- )
-)
+ name: (identifier) @type))))
(import_statement
"type"
(import_clause
(named_imports
(import_specifier
- alias: (identifier) @type
- )
- )
- )
-)
+ alias: (identifier) @type))))
([
(identifier)
(shorthand_property_identifier)
(shorthand_property_identifier_pattern)
- ] @constant
- (#match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
+] @constant
+ (#match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
; Properties
-
(property_identifier) @property
+
(shorthand_property_identifier) @property
+
(shorthand_property_identifier_pattern) @property
+
(private_property_identifier) @property
; Function and method calls
-
(call_expression
function: (identifier) @function)
(call_expression
function: (member_expression
- property: [(property_identifier) (private_property_identifier)] @function.method))
+ property: [
+ (property_identifier)
+ (private_property_identifier)
+ ] @function.method))
(new_expression
constructor: (identifier) @type)
@@ -162,38 +129,60 @@
module: (identifier) @type)
; Function and method definitions
-
(function_expression
name: (identifier) @function)
+
(function_declaration
name: (identifier) @function)
+
(method_definition
- name: [(property_identifier) (private_property_identifier)] @function.method)
+ name: [
+ (property_identifier)
+ (private_property_identifier)
+ ] @function.method)
+
(method_definition
- name: (property_identifier) @constructor
- (#eq? @constructor "constructor"))
+ name: (property_identifier) @constructor
+ (#eq? @constructor "constructor"))
(pair
- key: [(property_identifier) (private_property_identifier)] @function.method
- value: [(function_expression) (arrow_function)])
+ key: [
+ (property_identifier)
+ (private_property_identifier)
+ ] @function.method
+ value: [
+ (function_expression)
+ (arrow_function)
+ ])
(assignment_expression
left: (member_expression
- property: [(property_identifier) (private_property_identifier)] @function.method)
- right: [(function_expression) (arrow_function)])
+ property: [
+ (property_identifier)
+ (private_property_identifier)
+ ] @function.method)
+ right: [
+ (function_expression)
+ (arrow_function)
+ ])
(variable_declarator
name: (identifier) @function
- value: [(function_expression) (arrow_function)])
+ value: [
+ (function_expression)
+ (arrow_function)
+ ])
(assignment_expression
left: (identifier) @function
- right: [(function_expression) (arrow_function)])
+ right: [
+ (function_expression)
+ (arrow_function)
+ ])
(arrow_function) @function
; Parameters
-
(required_parameter
(identifier) @variable.parameter)
@@ -227,8 +216,8 @@
name: (identifier) @variable.parameter)
; Literals
-
(this) @variable.special
+
(super) @variable.special
[
@@ -247,8 +236,7 @@
(undefined)
(true)
(false)
- ] @type.builtin
-)
+ ] @type.builtin)
(comment) @comment
@@ -263,11 +251,12 @@
(escape_sequence) @string.escape
(regex) @string.regex
+
(regex_flags) @keyword.operator.regex
+
(number) @number
; Tokens
-
[
";"
"?."
@@ -326,14 +315,14 @@
"..."
] @operator
-(regex "/" @string.regex)
+(regex
+ "/" @string.regex)
(ternary_expression
[
"?"
":"
- ] @operator
-)
+ ] @operator)
[
"("
@@ -342,7 +331,7 @@
"]"
"{"
"}"
-] @punctuation.bracket
+] @punctuation.bracket
(template_substitution
"${" @punctuation.special
@@ -360,31 +349,32 @@
"<" @punctuation.bracket
">" @punctuation.bracket)
-(decorator "@" @punctuation.special)
+(decorator
+ "@" @punctuation.special)
(union_type
- ("|") @punctuation.special)
+ "|" @punctuation.special)
(intersection_type
- ("&") @punctuation.special)
+ "&" @punctuation.special)
(type_annotation
- (":") @punctuation.special)
+ ":" @punctuation.special)
(index_signature
- (":") @punctuation.special)
+ ":" @punctuation.special)
(type_predicate_annotation
- (":") @punctuation.special)
+ ":" @punctuation.special)
(public_field_definition
- ("?") @punctuation.special)
+ "?" @punctuation.special)
(property_signature
- ("?") @punctuation.special)
+ "?" @punctuation.special)
(method_signature
- ("?") @punctuation.special)
+ "?" @punctuation.special)
(optional_parameter
([
@@ -393,7 +383,6 @@
]) @punctuation.special)
; Keywords
-
[
"abstract"
"as"
@@ -465,4 +454,5 @@
"yield"
] @keyword.control
-(switch_default "default" @keyword.control)
+(switch_default
+ "default" @keyword.control)
@@ -1,20 +1,23 @@
(import_statement
- import_clause: (import_clause
- [
- (identifier) @name
- (named_imports
- (import_specifier
- name: (_) @name
- alias: (_)? @alias))
- (namespace_import) @wildcard
- ])
- source: (string (string_fragment) @source)) @import
+ import_clause: (import_clause
+ [
+ (identifier) @name
+ (named_imports
+ (import_specifier
+ name: (_) @name
+ alias: (_)? @alias))
+ (namespace_import) @wildcard
+ ])
+ source: (string
+ (string_fragment) @source)) @import
(import_statement
- !source
- import_clause: (import_require_clause
- source: (string (string_fragment) @source))) @wildcard @import
+ !source
+ import_clause: (import_require_clause
+ source: (string
+ (string_fragment) @source))) @wildcard @import
(import_statement
- !import_clause
- source: (string (string_fragment) @source)) @wildcard @import
+ !import_clause
+ source: (string
+ (string_fragment) @source)) @wildcard @import
@@ -1,17 +1,28 @@
[
- (call_expression)
- (assignment_expression)
- (member_expression)
- (lexical_declaration)
- (variable_declaration)
- (assignment_expression)
- ; below handled by `(_ "{" "}" @end) @indent`
- ; (if_statement)
- ; (for_statement)
- ; (while_statement)
+ (call_expression)
+ (assignment_expression)
+ (member_expression)
+ (lexical_declaration)
+ (variable_declaration)
+ (assignment_expression)
+ ; below handled by `(_ "{" "}" @end) @indent`
+ ; (if_statement)
+ ; (for_statement)
+ ; (while_statement)
] @indent
-(_ "[" "]" @end) @indent
-(_ "<" ">" @end) @indent
-(_ "{" "}" @end) @indent
-(_ "(" ")" @end) @indent
+(_
+ "["
+ "]" @end) @indent
+
+(_
+ "<"
+ ">" @end) @indent
+
+(_
+ "{"
+ "}" @end) @indent
+
+(_
+ "("
+ ")" @end) @indent
@@ -1,6 +1,5 @@
((comment) @injection.content
- (#set! injection.language "comment")
-)
+ (#set! injection.language "comment"))
(((comment) @_jsdoc_comment
(#match? @_jsdoc_comment "(?s)^/[*][*][^*].*[*]/$")) @injection.content
@@ -14,156 +13,187 @@
(#set! injection.language "regex"))
(call_expression
- function: (identifier) @_name (#eq? @_name "css")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "css"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "css")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "css")))
(call_expression
function: (member_expression
- object: (identifier) @_obj (#eq? @_obj "styled")
+ object: (identifier) @_obj
+ (#eq? @_obj "styled")
property: (property_identifier))
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "css"))
-)
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "css")))
(call_expression
function: (call_expression
- function: (identifier) @_name (#eq? @_name "styled"))
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "css"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "styled"))
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "css")))
(call_expression
- function: (identifier) @_name (#eq? @_name "html")
+ function: (identifier) @_name
+ (#eq? @_name "html")
arguments: (template_string) @injection.content
- (#set! injection.language "html")
-)
+ (#set! injection.language "html"))
(call_expression
- function: (identifier) @_name (#eq? @_name "js")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "javascript"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "js")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "javascript")))
(call_expression
- function: (identifier) @_name (#eq? @_name "json")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "json"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "json")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "json")))
(call_expression
- function: (identifier) @_name (#eq? @_name "sql")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "sql"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "sql")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "sql")))
(call_expression
- function: (identifier) @_name (#eq? @_name "ts")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "typescript"))
-)
+ function: (identifier) @_name
+ (#eq? @_name "ts")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "typescript")))
(call_expression
- function: (identifier) @_name (#match? @_name "^ya?ml$")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "yaml"))
-)
+ function: (identifier) @_name
+ (#match? @_name "^ya?ml$")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "yaml")))
(call_expression
- function: (identifier) @_name (#match? @_name "^g(raph)?ql$")
- arguments: (template_string (string_fragment) @injection.content
- (#set! injection.language "graphql"))
-)
+ function: (identifier) @_name
+ (#match? @_name "^g(raph)?ql$")
+ arguments: (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "graphql")))
(call_expression
- function: (identifier) @_name (#match? @_name "^g(raph)?ql$")
- arguments: (arguments (template_string (string_fragment) @injection.content
- (#set! injection.language "graphql")))
-)
+ function: (identifier) @_name
+ (#match? @_name "^g(raph)?ql$")
+ arguments: (arguments
+ (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "graphql"))))
(call_expression
- function: (identifier) @_name(#match? @_name "^iso$")
- arguments: (arguments (template_string (string_fragment) @injection.content
- (#set! injection.language "isograph")))
-)
-
-;; Angular Component template injection
+ function: (identifier) @_name
+ (#match? @_name "^iso$")
+ arguments: (arguments
+ (template_string
+ (string_fragment) @injection.content
+ (#set! injection.language "isograph"))))
+
+; Angular Component template injection
(call_expression
function: [
- (identifier) @_decorator (#eq? @_decorator "Component")
- (member_expression property: (property_identifier) @_decorator (#eq? @_decorator "Component"))
+ (identifier) @_decorator
+ (#eq? @_decorator "Component")
+ (member_expression
+ property: (property_identifier) @_decorator
+ (#eq? @_decorator "Component"))
]
- arguments: (arguments (object
- (pair
- key: (property_identifier) @_prop (#eq? @_prop "template")
- value: [
- (string) @injection.content
- (template_string) @injection.content
- (template_string (string_fragment) @injection.content)
- ]
- )))
+ arguments: (arguments
+ (object
+ (pair
+ key: (property_identifier) @_prop
+ (#eq? @_prop "template")
+ value: [
+ (string) @injection.content
+ (template_string) @injection.content
+ (template_string
+ (string_fragment) @injection.content)
+ ])))
(#set! injection.language "angular"))
-;; Angular Component styles injection
+; Angular Component styles injection
(call_expression
function: [
- (identifier) @_decorator (#eq? @_decorator "Component")
- (member_expression property: (property_identifier) @_decorator (#eq? @_decorator "Component"))
+ (identifier) @_decorator
+ (#eq? @_decorator "Component")
+ (member_expression
+ property: (property_identifier) @_decorator
+ (#eq? @_decorator "Component"))
]
- arguments: (arguments (object
- (pair
- key: (property_identifier) @_prop (#eq? @_prop "styles")
- value: [
- (string) @injection.content
- (template_string) @injection.content
- (template_string (string_fragment) @injection.content)
- (array (string) @injection.content)
- (array (template_string) @injection.content)
- (array (template_string (string_fragment)) @injection.content)
- ]
- )))
+ arguments: (arguments
+ (object
+ (pair
+ key: (property_identifier) @_prop
+ (#eq? @_prop "styles")
+ value: [
+ (string) @injection.content
+ (template_string) @injection.content
+ (template_string
+ (string_fragment) @injection.content)
+ (array
+ (string) @injection.content)
+ (array
+ (template_string) @injection.content)
+ (array
+ (template_string
+ (string_fragment)) @injection.content)
+ ])))
(#set! injection.language "css"))
; Parse the contents of strings and tagged template
; literals with leading ECMAScript comments:
; '/* html */' or '/*html*/'
-(
- ((comment) @_ecma_comment [
- (string (string_fragment) @injection.content)
- (template_string (string_fragment) @injection.content)
+(((comment) @_ecma_comment
+ [
+ (string
+ (string_fragment) @injection.content)
+ (template_string
+ (string_fragment) @injection.content)
])
(#match? @_ecma_comment "^\\/\\*\\s*html\\s*\\*\\/")
- (#set! injection.language "html")
-)
+ (#set! injection.language "html"))
; '/* sql */' or '/*sql*/'
-(
- ((comment) @_ecma_comment [
- (string (string_fragment) @injection.content)
- (template_string (string_fragment) @injection.content)
+(((comment) @_ecma_comment
+ [
+ (string
+ (string_fragment) @injection.content)
+ (template_string
+ (string_fragment) @injection.content)
])
(#match? @_ecma_comment "^\\/\\*\\s*sql\\s*\\*\\/")
- (#set! injection.language "sql")
-)
+ (#set! injection.language "sql"))
; '/* gql */' or '/*gql*/'
; '/* graphql */' or '/*graphql*/'
-(
- ((comment) @_ecma_comment [
- (string (string_fragment) @injection.content)
- (template_string (string_fragment) @injection.content)
+(((comment) @_ecma_comment
+ [
+ (string
+ (string_fragment) @injection.content)
+ (template_string
+ (string_fragment) @injection.content)
])
(#match? @_ecma_comment "^\\/\\*\\s*(gql|graphql)\\s*\\*\\/")
- (#set! injection.language "graphql")
-)
+ (#set! injection.language "graphql"))
; '/* css */' or '/*css*/'
-(
- ((comment) @_ecma_comment [
- (string (string_fragment) @injection.content)
- (template_string (string_fragment) @injection.content)
+(((comment) @_ecma_comment
+ [
+ (string
+ (string_fragment) @injection.content)
+ (template_string
+ (string_fragment) @injection.content)
])
(#match? @_ecma_comment "^\\/\\*\\s*(css)\\s*\\*\\/")
- (#set! injection.language "css")
-)
+ (#set! injection.language "css"))
@@ -1,230 +1,275 @@
(internal_module
- "namespace" @context
- name: (_) @name) @item
+ "namespace" @context
+ name: (_) @name) @item
(enum_declaration
- "enum" @context
- name: (_) @name) @item
+ "enum" @context
+ name: (_) @name) @item
(type_alias_declaration
- "type" @context
- name: (_) @name) @item
+ "type" @context
+ name: (_) @name) @item
(function_declaration
- "async"? @context
- "function" @context
- name: (_) @name
- parameters: (formal_parameters
- "(" @context
- ")" @context)) @item
+ "async"? @context
+ "function" @context
+ name: (_) @name
+ parameters: (formal_parameters
+ "(" @context
+ ")" @context)) @item
(generator_function_declaration
- "async"? @context
- "function" @context
- "*" @context
- name: (_) @name
- parameters: (formal_parameters
- "(" @context
- ")" @context)) @item
+ "async"? @context
+ "function" @context
+ "*" @context
+ name: (_) @name
+ parameters: (formal_parameters
+ "(" @context
+ ")" @context)) @item
(interface_declaration
- "interface" @context
- name: (_) @name) @item
+ "interface" @context
+ name: (_) @name) @item
(export_statement
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (identifier) @name) @item))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (identifier) @name) @item))
; Exported array destructuring
(export_statement
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (array_pattern
- [
- (identifier) @name @item
- (assignment_pattern left: (identifier) @name @item)
- (rest_pattern (identifier) @name @item)
- ]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (array_pattern
+ [
+ (identifier) @name @item
+ (assignment_pattern
+ left: (identifier) @name @item)
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
; Exported object destructuring
(export_statement
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (object_pattern
- [(shorthand_property_identifier_pattern) @name @item
- (pair_pattern
- value: (identifier) @name @item)
- (pair_pattern
- value: (assignment_pattern left: (identifier) @name @item))
- (rest_pattern (identifier) @name @item)]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (object_pattern
+ [
+ (shorthand_property_identifier_pattern) @name @item
+ (pair_pattern
+ value: (identifier) @name @item)
+ (pair_pattern
+ value: (assignment_pattern
+ left: (identifier) @name @item))
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
(program
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (identifier) @name) @item))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (identifier) @name) @item))
; Top-level array destructuring
(program
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (array_pattern
- [
- (identifier) @name @item
- (assignment_pattern left: (identifier) @name @item)
- (rest_pattern (identifier) @name @item)
- ]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (array_pattern
+ [
+ (identifier) @name @item
+ (assignment_pattern
+ left: (identifier) @name @item)
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
; Top-level object destructuring
(program
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (object_pattern
- [(shorthand_property_identifier_pattern) @name @item
- (pair_pattern
- value: (identifier) @name @item)
- (pair_pattern
- value: (assignment_pattern left: (identifier) @name @item))
- (rest_pattern (identifier) @name @item)]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (object_pattern
+ [
+ (shorthand_property_identifier_pattern) @name @item
+ (pair_pattern
+ value: (identifier) @name @item)
+ (pair_pattern
+ value: (assignment_pattern
+ left: (identifier) @name @item))
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
(class_declaration
- "class" @context
- name: (_) @name) @item
+ "class" @context
+ name: (_) @name) @item
(abstract_class_declaration
- "abstract" @context
- "class" @context
- name: (_) @name) @item
+ "abstract" @context
+ "class" @context
+ name: (_) @name) @item
; Method definitions in classes (not in object literals)
(class_body
- (method_definition
- [
- "get"
- "set"
- "async"
- "*"
- "readonly"
- "static"
- (override_modifier)
- (accessibility_modifier)
- ]* @context
- name: (_) @name
- parameters: (formal_parameters
- "(" @context
- ")" @context)) @item)
+ (method_definition
+ [
+ "get"
+ "set"
+ "async"
+ "*"
+ "readonly"
+ "static"
+ (override_modifier)
+ (accessibility_modifier)
+ ]* @context
+ name: (_) @name
+ parameters: (formal_parameters
+ "(" @context
+ ")" @context)) @item)
; Object literal methods
(variable_declarator
- value: (object
- (method_definition
- [
- "get"
- "set"
- "async"
- "*"
- ]* @context
- name: (_) @name
- parameters: (formal_parameters
- "(" @context
- ")" @context)) @item))
+ value: (object
+ (method_definition
+ [
+ "get"
+ "set"
+ "async"
+ "*"
+ ]* @context
+ name: (_) @name
+ parameters: (formal_parameters
+ "(" @context
+ ")" @context)) @item))
(public_field_definition
- [
- "declare"
- "readonly"
- "abstract"
- "static"
- (accessibility_modifier)
- ]* @context
- name: (_) @name) @item
+ [
+ "declare"
+ "readonly"
+ "abstract"
+ "static"
+ (accessibility_modifier)
+ ]* @context
+ name: (_) @name) @item
; Add support for (node:test, bun:test and Jest) runnable
-(
- (call_expression
- function: [
- (identifier) @_name
- (member_expression
- object: [
- (identifier) @_name
- (member_expression object: (identifier) @_name)
- ]
- )
- ] @context
- (#any-of? @_name "it" "test" "describe" "context" "suite")
- arguments: (
- arguments . [
- (string (string_fragment) @name)
- (identifier) @name
- ]
- )
- )
-) @item
+((call_expression
+ function: [
+ (identifier) @_name
+ (member_expression
+ object: [
+ (identifier) @_name
+ (member_expression
+ object: (identifier) @_name)
+ ])
+ ] @context
+ (#any-of? @_name "it" "test" "describe" "context" "suite")
+ arguments: (arguments
+ .
+ [
+ (string
+ (string_fragment) @name)
+ (identifier) @name
+ ]))) @item
; Add support for parameterized tests
-(
- (call_expression
- function: (call_expression
- function: (member_expression
- object: [(identifier) @_name (member_expression object: (identifier) @_name)]
- property: (property_identifier) @_property
- )
- (#any-of? @_name "it" "test" "describe" "context" "suite")
- (#any-of? @_property "each")
- )
- arguments: (
- arguments . [
- (string (string_fragment) @name)
- (identifier) @name
- ]
- )
- )
-) @item
+((call_expression
+ function: (call_expression
+ function: (member_expression
+ object: [
+ (identifier) @_name
+ (member_expression
+ object: (identifier) @_name)
+ ]
+ property: (property_identifier) @_property)
+ (#any-of? @_name "it" "test" "describe" "context" "suite")
+ (#any-of? @_property "each"))
+ arguments: (arguments
+ .
+ [
+ (string
+ (string_fragment) @name)
+ (identifier) @name
+ ]))) @item
; Object properties
(pair
- key: [
- (property_identifier) @name
- (string (string_fragment) @name)
- (number) @name
- (computed_property_name) @name
- ]) @item
-
+ key: [
+ (property_identifier) @name
+ (string
+ (string_fragment) @name)
+ (number) @name
+ (computed_property_name) @name
+ ]) @item
; Nested variables in function bodies
(statement_block
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (identifier) @name) @item))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (identifier) @name) @item))
; Nested array destructuring in functions
(statement_block
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (array_pattern
- [
- (identifier) @name @item
- (assignment_pattern left: (identifier) @name @item)
- (rest_pattern (identifier) @name @item)
- ]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (array_pattern
+ [
+ (identifier) @name @item
+ (assignment_pattern
+ left: (identifier) @name @item)
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
; Nested object destructuring in functions
(statement_block
- (lexical_declaration
- ["let" "const"] @context
- (variable_declarator
- name: (object_pattern
- [(shorthand_property_identifier_pattern) @name @item
- (pair_pattern value: (identifier) @name @item)
- (pair_pattern value: (assignment_pattern left: (identifier) @name @item))
- (rest_pattern (identifier) @name @item)]))))
+ (lexical_declaration
+ [
+ "let"
+ "const"
+ ] @context
+ (variable_declarator
+ name: (object_pattern
+ [
+ (shorthand_property_identifier_pattern) @name @item
+ (pair_pattern
+ value: (identifier) @name @item)
+ (pair_pattern
+ value: (assignment_pattern
+ left: (identifier) @name @item))
+ (rest_pattern
+ (identifier) @name @item)
+ ]))))
(comment) @annotation
@@ -2,8 +2,10 @@
(string) @string
-(template_string (string_fragment) @string)
+(template_string
+ (string_fragment) @string)
-(_ value: (call_expression
- function: (identifier) @function_name_before_type_arguments
- type_arguments: (type_arguments)))
+(_
+ value: (call_expression
+ function: (identifier) @function_name_before_type_arguments
+ type_arguments: (type_arguments)))
@@ -1,85 +1,71 @@
; Add support for (node:test, bun:test, Jest and Deno.test) runnable
; Function expression that has `it`, `test` or `describe` as the function name
-(
- (call_expression
- function: [
- (identifier) @_name
- (member_expression
- object: [
- (identifier) @_name
- (member_expression object: (identifier) @_name)
- ]
- )
- ]
- (#any-of? @_name "it" "test" "describe" "context" "suite")
- arguments: (
- arguments . [
- (string (string_fragment) @run)
- (identifier) @run
- ]
- )
- ) @_js-test
-
- (#set! tag js-test)
-)
+((call_expression
+ function: [
+ (identifier) @_name
+ (member_expression
+ object: [
+ (identifier) @_name
+ (member_expression
+ object: (identifier) @_name)
+ ])
+ ]
+ (#any-of? @_name "it" "test" "describe" "context" "suite")
+ arguments: (arguments
+ .
+ [
+ (string
+ (string_fragment) @run)
+ (identifier) @run
+ ])) @_js-test
+ (#set! tag js-test))
; Add support for parameterized tests
-(
- (call_expression
- function: (call_expression
- function: (member_expression
- object: [(identifier) @_name (member_expression object: (identifier) @_name)]
- property: (property_identifier) @_property
- )
- (#any-of? @_name "it" "test" "describe" "context" "suite")
- (#any-of? @_property "each")
- )
- arguments: (
- arguments . [
- (string (string_fragment) @run)
- (identifier) @run
- ]
- )
- ) @_js-test
-
- (#set! tag js-test)
-)
+((call_expression
+ function: (call_expression
+ function: (member_expression
+ object: [
+ (identifier) @_name
+ (member_expression
+ object: (identifier) @_name)
+ ]
+ property: (property_identifier) @_property)
+ (#any-of? @_name "it" "test" "describe" "context" "suite")
+ (#any-of? @_property "each"))
+ arguments: (arguments
+ .
+ [
+ (string
+ (string_fragment) @run)
+ (identifier) @run
+ ])) @_js-test
+ (#set! tag js-test))
; Add support for Deno.test with string names
-(
- (call_expression
- function: (member_expression
- object: (identifier) @_namespace
- property: (property_identifier) @_method
- )
- (#eq? @_namespace "Deno")
- (#eq? @_method "test")
- arguments: (
- arguments . [
- (string (string_fragment) @run @DENO_TEST_NAME)
- (identifier) @run @DENO_TEST_NAME
- ]
- )
- ) @_js-test
-
- (#set! tag js-test)
-)
+((call_expression
+ function: (member_expression
+ object: (identifier) @_namespace
+ property: (property_identifier) @_method)
+ (#eq? @_namespace "Deno")
+ (#eq? @_method "test")
+ arguments: (arguments
+ .
+ [
+ (string
+ (string_fragment) @run @DENO_TEST_NAME)
+ (identifier) @run @DENO_TEST_NAME
+ ])) @_js-test
+ (#set! tag js-test))
; Add support for Deno.test with named function expressions
-(
- (call_expression
- function: (member_expression
- object: (identifier) @_namespace
- property: (property_identifier) @_method
- )
- (#eq? @_namespace "Deno")
- (#eq? @_method "test")
- arguments: (
- arguments . (function_expression
- name: (identifier) @run @DENO_TEST_NAME
- )
- )
- ) @_js-test
-
- (#set! tag js-test)
-)
+((call_expression
+ function: (member_expression
+ object: (identifier) @_namespace
+ property: (property_identifier) @_method)
+ (#eq? @_namespace "Deno")
+ (#eq? @_method "test")
+ arguments: (arguments
+ .
+ (function_expression
+ name: (identifier) @run @DENO_TEST_NAME))) @_js-test
+ (#set! tag js-test))
@@ -1,114 +1,130 @@
(comment)+ @comment.around
(function_declaration
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(method_definition
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(function_expression
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
((arrow_function
- body: (statement_block
- "{"
- (_)* @function.inside
- "}")) @function.around
- (#not-has-parent? @function.around variable_declarator))
+ body: (statement_block
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
+ (#not-has-parent? @function.around variable_declarator))
; Arrow function in variable declaration - capture the full declaration
([
- (lexical_declaration
- (variable_declarator
- value: (arrow_function
- body: (statement_block
- "{"
- (_)* @function.inside
- "}"))))
- (variable_declaration
- (variable_declarator
- value: (arrow_function
- body: (statement_block
- "{"
- (_)* @function.inside
- "}"))))
+ (lexical_declaration
+ (variable_declarator
+ value: (arrow_function
+ body: (statement_block
+ "{"
+ (_)* @function.inside
+ "}"))))
+ (variable_declaration
+ (variable_declarator
+ value: (arrow_function
+ body: (statement_block
+ "{"
+ (_)* @function.inside
+ "}"))))
]) @function.around
; Arrow function in variable declaration - capture body as @function.inside
; (for statement blocks, the more specific pattern above captures just the contents)
([
- (lexical_declaration
- (variable_declarator
- value: (arrow_function
- body: (_) @function.inside)))
- (variable_declaration
- (variable_declarator
- value: (arrow_function
- body: (_) @function.inside)))
+ (lexical_declaration
+ (variable_declarator
+ value: (arrow_function
+ body: (_) @function.inside)))
+ (variable_declaration
+ (variable_declarator
+ value: (arrow_function
+ body: (_) @function.inside)))
]) @function.around
; Catch-all for arrow functions in other contexts (callbacks, etc.)
((arrow_function
- body: (_) @function.inside) @function.around
- (#not-has-parent? @function.around variable_declarator))
+ body: (_) @function.inside) @function.around
+ (#not-has-parent? @function.around variable_declarator))
+
(function_signature) @function.around
(generator_function
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(generator_function_declaration
- body: (_
- "{"
- (_)* @function.inside
- "}")) @function.around
+ body: (_
+ "{"
+ (_)* @function.inside
+ "}")) @function.around
(class_declaration
- body: (_
- "{"
- [(_) ";"?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ";"?
+ ]* @class.inside
+ "}")) @class.around
(class
- body: (_
- "{"
- (_)* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ (_)* @class.inside
+ "}")) @class.around
(interface_declaration
- body: (_
- "{"
- [(_) ";"?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ";"?
+ ]* @class.inside
+ "}")) @class.around
(enum_declaration
- body: (_
- "{"
- [(_) ","?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ","?
+ ]* @class.inside
+ "}")) @class.around
(ambient_declaration
- (module
+ (module
body: (_
- "{"
- [(_) ";"?]* @class.inside
- "}" ))) @class.around
+ "{"
+ [
+ (_)
+ ";"?
+ ]* @class.inside
+ "}"))) @class.around
(internal_module
- body: (_
- "{"
- [(_) ";"?]* @class.inside
- "}" )) @class.around
+ body: (_
+ "{"
+ [
+ (_)
+ ";"?
+ ]* @class.inside
+ "}")) @class.around
(type_alias_declaration) @class.around
@@ -1,4 +1,13 @@
-("[" @open "]" @close)
-("{" @open "}" @close)
-(("\"" @open "\"" @close) (#set! rainbow.exclude))
-(("'" @open "'" @close) (#set! rainbow.exclude))
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+(("\"" @open
+ "\"" @close)
+ (#set! rainbow.exclude))
+
+(("'" @open
+ "'" @close)
+ (#set! rainbow.exclude))
@@ -1,4 +1,5 @@
(boolean_scalar) @boolean
+
(null_scalar) @constant.builtin
[
@@ -25,30 +26,31 @@
key: (flow_node
[
- (plain_scalar (string_scalar))
+ (plain_scalar
+ (string_scalar))
(double_quote_scalar)
(single_quote_scalar)
] @property)
[
- ","
- "-"
- ":"
- ">"
- "?"
- "|"
+ ","
+ "-"
+ ":"
+ ">"
+ "?"
+ "|"
] @punctuation.delimiter
[
- "["
- "]"
- "{"
- "}"
+ "["
+ "]"
+ "{"
+ "}"
] @punctuation.bracket
[
- "*"
- "&"
- "---"
- "..."
+ "*"
+ "&"
+ "---"
+ "..."
] @punctuation.special
@@ -1,25 +1,26 @@
((comment) @injection.content
- (#set! injection.language "comment")
-)
+ (#set! injection.language "comment"))
; GitHub actions: JavaScript for workflow scripting (inline and block)
(block_mapping
(block_mapping_pair
- key: (flow_node) @_uses (#eq? @_uses "uses")
- value: (flow_node) @_actions_ghs (#match? @_actions_ghs "^actions/github-script"))
+ key: (flow_node) @_uses
+ (#eq? @_uses "uses")
+ value: (flow_node) @_actions_ghs
+ (#match? @_actions_ghs "^actions/github-script"))
(block_mapping_pair
- key: (flow_node) @_with (#eq? @_with "with")
+ key: (flow_node) @_with
+ (#eq? @_with "with")
value: (block_node
(block_mapping
(block_mapping_pair
- key: (flow_node) @_run (#eq? @_run "script")
+ key: (flow_node) @_run
+ (#eq? @_run "script")
value: [
- (flow_node (plain_scalar (string_scalar) @injection.content))
- (block_node (block_scalar) @injection.content)
+ (flow_node
+ (plain_scalar
+ (string_scalar) @injection.content))
+ (block_node
+ (block_scalar) @injection.content)
]
- (#set! injection.language "javascript")
- )
- )
- )
- )
-)
+ (#set! injection.language "javascript"))))))
@@ -1,9 +1,7 @@
(block_mapping_pair
- key:
- (flow_node
- (plain_scalar
- (string_scalar) @name))
- value:
- (flow_node
- (plain_scalar
- (string_scalar) @context))?) @item
+ key: (flow_node
+ (plain_scalar
+ (string_scalar) @name))
+ value: (flow_node
+ (plain_scalar
+ (string_scalar) @context))?) @item
@@ -1,4 +1,5 @@
(comment) @comment.inclusive
+
[
(single_quote_scalar)
(double_quote_scalar)
@@ -1 +1,2 @@
-(block_mapping_pair value: (flow_node) @redact)
+(block_mapping_pair
+ value: (flow_node) @redact)
@@ -1 +1,2 @@
-("(" @open ")" @close)
+("(" @open
+ ")" @close)
@@ -1,3 +1,8 @@
-("[" @open "]" @close)
-("{" @open "}" @close)
-("(" @open ")" @close)
+("[" @open
+ "]" @close)
+
+("{" @open
+ "}" @close)
+
+("(" @open
+ ")" @close)
@@ -1,82 +1,136 @@
"break" @keyword
+
"case" @keyword
+
"const" @keyword
+
"continue" @keyword
+
"default" @keyword
+
"do" @keyword
+
"else" @keyword
+
"enum" @keyword
+
"extern" @keyword
+
"for" @keyword
+
"if" @keyword
+
"inline" @keyword
+
"return" @keyword
+
"sizeof" @keyword
+
"static" @keyword
+
"struct" @keyword
+
"switch" @keyword
+
"typedef" @keyword
+
"union" @keyword
+
"volatile" @keyword
+
"while" @keyword
"#define" @keyword
+
"#elif" @keyword
+
"#else" @keyword
+
"#endif" @keyword
+
"#if" @keyword
+
"#ifdef" @keyword
+
"#ifndef" @keyword
+
"#include" @keyword
+
(preproc_directive) @keyword
"--" @operator
+
"-" @operator
+
"-=" @operator
+
"->" @operator
+
"=" @operator
+
"!=" @operator
+
"*" @operator
+
"&" @operator
+
"&&" @operator
+
"+" @operator
+
"++" @operator
+
"+=" @operator
+
"<" @operator
+
"==" @operator
+
">" @operator
+
"||" @operator
"." @delimiter
+
";" @delimiter
(string_literal) @string
+
(system_lib_string) @string
(null) @constant
+
(number_literal) @number
+
(char_literal) @number
(identifier) @variable
(field_identifier) @property
+
(statement_identifier) @label
+
(type_identifier) @type
+
(primitive_type) @type
+
(sized_type_specifier) @type
(call_expression
function: (identifier) @function)
+
(call_expression
function: (field_expression
field: (field_identifier) @function))
+
(function_declarator
declarator: (identifier) @function)
+
(preproc_function_def
name: (identifier) @function.special)
((identifier) @constant
- (#match? @constant "^[A-Z][A-Z\\d_]*$"))
+ (#match? @constant "^[A-Z][A-Z\\d_]*$"))
(comment) @comment
@@ -111,7 +165,5 @@
(extension_storage_class) @storageclass
-(
- (identifier) @variable.builtin
- (#match? @variable.builtin "^gl_")
-)
+((identifier) @variable.builtin
+ (#match? @variable.builtin "^gl_"))
@@ -1,12 +1,17 @@
(tag_name) @tag
+
(doctype) @tag.doctype
+
(attribute_name) @attribute
+
[
"\""
"'"
(attribute_value)
] @string
+
(comment) @comment
+
(entity) @string.special
"=" @punctuation.delimiter.html
@@ -1,5 +1,8 @@
-(start_tag ">" @end) @indent
-(self_closing_tag "/>" @end) @indent
+(start_tag
+ ">" @end) @indent
+
+(self_closing_tag
+ "/>" @end) @indent
(element
(start_tag) @start
@@ -1,6 +1,5 @@
((comment) @injection.content
- (#set! injection.language "comment")
-)
+ (#set! injection.language "comment"))
(script_element
(raw_text) @injection.content
@@ -11,11 +10,15 @@
(#set! injection.language "css"))
(attribute
- (attribute_name) @_attribute_name (#match? @_attribute_name "^style$")
- (quoted_attribute_value (attribute_value) @injection.content)
- (#set! injection.language "css"))
+ (attribute_name) @_attribute_name
+ (#match? @_attribute_name "^style$")
+ (quoted_attribute_value
+ (attribute_value) @injection.content)
+ (#set! injection.language "css"))
(attribute
- (attribute_name) @_attribute_name (#match? @_attribute_name "^on[a-z]+$")
- (quoted_attribute_value (attribute_value) @injection.content)
- (#set! injection.language "javascript"))
+ (attribute_name) @_attribute_name
+ (#match? @_attribute_name "^on[a-z]+$")
+ (quoted_attribute_value
+ (attribute_value) @injection.content)
+ (#set! injection.language "javascript"))
@@ -1,4 +1,5 @@
(comment) @comment
+
(quoted_attribute_value) @string
[
@@ -52,11 +52,11 @@
"}"
"<"
">"
-] @punctuation.bracket
+] @punctuation.bracket
[
- ";"
- ","
+ ";"
+ ","
] @punctuation.delimiter
"=" @operator
@@ -1,3 +1,11 @@
-(_ "{" "}" @end) @indent
-(_ "[" "]" @end) @indent
-(_ "(" ")" @end) @indent
+(_
+ "{"
+ "}" @end) @indent
+
+(_
+ "["
+ "]" @end) @indent
+
+(_
+ "("
+ ")" @end) @indent
@@ -1,19 +1,19 @@
(message
- "message" @context
- (message_name
- (identifier) @name)) @item
+ "message" @context
+ (message_name
+ (identifier) @name)) @item
(service
- "service" @context
- (service_name
- (identifier) @name)) @item
+ "service" @context
+ (service_name
+ (identifier) @name)) @item
(rpc
- "rpc" @context
- (rpc_name
- (identifier) @name)) @item
+ "rpc" @context
+ (rpc_name
+ (identifier) @name)) @item
(enum
- "enum" @context
- (enum_name
- (identifier) @name)) @item
+ "enum" @context
+ (enum_name
+ (identifier) @name)) @item
@@ -1,17 +1,21 @@
-(message (message_body
+(message
+ (message_body
"{"
(_)* @class.inside
"}")) @class.around
-(enum (enum_body
+
+(enum
+ (enum_body
"{"
(_)* @class.inside
"}")) @class.around
+
(service
- "service"
- (_)
- "{"
- (_)* @class.inside
- "}") @class.around
+ "service"
+ (_)
+ "{"
+ (_)* @class.inside
+ "}") @class.around
(rpc) @function.around
@@ -1,6 +1,8 @@
; Comments
(module_comment) @comment
+
(statement_comment) @comment
+
(comment) @comment
; Constants
@@ -9,43 +11,61 @@
; Variables
(identifier) @variable
+
(discard) @comment.unused
; Modules
(module) @module
-(import alias: (identifier) @module)
+
+(import
+ alias: (identifier) @module)
+
(remote_type_identifier
module: (identifier) @module)
+
(remote_constructor_name
module: (identifier) @module)
+
((field_access
record: (identifier) @module
field: (label) @function)
- (#is-not? local))
+ (#is-not? local))
; Functions
-(unqualified_import (identifier) @function)
-(unqualified_import "type" (type_identifier) @type)
-(unqualified_import (type_identifier) @constructor)
+(unqualified_import
+ (identifier) @function)
+
+(unqualified_import
+ "type"
+ (type_identifier) @type)
+
+(unqualified_import
+ (type_identifier) @constructor)
+
(function
name: (identifier) @function)
+
(external_function
name: (identifier) @function)
+
(function_parameter
name: (identifier) @variable.parameter)
+
((function_call
- function: (identifier) @function)
- (#is-not? local))
+ function: (identifier) @function)
+ (#is-not? local))
+
((binary_expression
- operator: "|>"
- right: (identifier) @function)
- (#is-not? local))
+ operator: "|>"
+ right: (identifier) @function)
+ (#is-not? local))
; "Properties"
; Assumed to be intended to refer to a name for a field; something that comes
; before ":" or after "."
; e.g. record field names, tuple indices, names for named arguments, etc
(label) @property
+
(tuple_access
index: (integer) @property)
@@ -54,10 +74,12 @@
"@" @attribute
name: (identifier) @attribute)
-(attribute_value (identifier) @constant)
+(attribute_value
+ (identifier) @constant)
; Type names
(remote_type_identifier) @type
+
(type_identifier) @type
; Data constructors
@@ -65,19 +87,24 @@
; Literals
(string) @string
+
((escape_sequence) @warning
- ; Deprecated in v0.33.0-rc2:
- (#eq? @warning "\\e"))
+ ; Deprecated in v0.33.0-rc2:
+ (#eq? @warning "\\e"))
+
(escape_sequence) @string.escape
+
(bit_string_segment_option) @function.builtin
+
(integer) @number
+
(float) @number
; Reserved identifiers
; TODO: when tree-sitter supports `#any-of?` in the Rust bindings,
; refactor this to use `#any-of?` rather than `#match?`
((identifier) @warning
- (#match? @warning "^(auto|delegate|derive|else|implement|macro|test|echo)$"))
+ (#match? @warning "^(auto|delegate|derive|else|implement|macro|test|echo)$"))
; Keywords
[
@@ -102,8 +129,12 @@
; Operators
(binary_expression
operator: _ @operator)
-(boolean_negation "!" @operator)
-(integer_negation "-" @operator)
+
+(boolean_negation
+ "!" @operator)
+
+(integer_negation
+ "-" @operator)
; Punctuation
[
@@ -116,10 +147,11 @@
"<<"
">>"
] @punctuation.bracket
+
[
"."
","
- ;; Controversial -- maybe some are operators?
+ ; Controversial -- maybe some are operators?
":"
"#"
"="
@@ -1,3 +1,11 @@
-(_ "[" "]" @end) @indent
-(_ "{" "}" @end) @indent
-(_ "(" ")" @end) @indent
+(_
+ "["
+ "]" @end) @indent
+
+(_
+ "{"
+ "}" @end) @indent
+
+(_
+ "("
+ ")" @end) @indent
@@ -1,31 +1,31 @@
(external_type
- (visibility_modifier)? @context
- "type" @context
- (type_name) @name) @item
+ (visibility_modifier)? @context
+ "type" @context
+ (type_name) @name) @item
(type_definition
- (visibility_modifier)? @context
- (opacity_modifier)? @context
- "type" @context
- (type_name) @name) @item
+ (visibility_modifier)? @context
+ (opacity_modifier)? @context
+ "type" @context
+ (type_name) @name) @item
(data_constructor
- (constructor_name) @name) @item
+ (constructor_name) @name) @item
(data_constructor_argument
- (label) @name) @item
+ (label) @name) @item
(type_alias
- (visibility_modifier)? @context
- "type" @context
- (type_name) @name) @item
+ (visibility_modifier)? @context
+ "type" @context
+ (type_name) @name) @item
(function
- (visibility_modifier)? @context
- "fn" @context
- name: (_) @name) @item
+ (visibility_modifier)? @context
+ "fn" @context
+ name: (_) @name) @item
(constant
- (visibility_modifier)? @context
- "const" @context
- name: (_) @name) @item
+ (visibility_modifier)? @context
+ "const" @context
+ name: (_) @name) @item