mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-31 19:05:00 +07:00
Format Tree-sitter queries with ts_query_ls (#50138)
Release Notes: - N/A
This commit is contained in:
parent
c5f83f570c
commit
5ed538f49c
143 changed files with 4770 additions and 3774 deletions
|
|
@ -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
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -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
|
||||
)
|
||||
]
|
||||
)
|
||||
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_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)
|
||||
|
||||
(if_expression (identifier) @debug-variable)
|
||||
(while_expression (identifier) @debug-variable)
|
||||
(tuple_expression
|
||||
(identifier) @debug-variable)
|
||||
|
||||
(parenthesized_expression (identifier) @debug-variable)
|
||||
(return_expression
|
||||
(identifier) @debug-variable)
|
||||
|
||||
(arguments (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)
|
||||
|
||||
(while_expression
|
||||
(identifier) @debug-variable)
|
||||
|
||||
(parenthesized_expression
|
||||
(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)
|
||||
(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_]*$"))
|
||||
]))
|
||||
(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_]*$"))
|
||||
]))
|
||||
(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)
|
||||
|
||||
(use_list
|
||||
(identifier) @name)
|
||||
|
||||
(use_declaration
|
||||
(identifier) @name)
|
||||
|
||||
(use_as_clause
|
||||
path: (scoped_identifier
|
||||
path: (_) @namespace
|
||||
name: (identifier) @name)
|
||||
|
||||
(use_list (identifier) @name)
|
||||
|
||||
(use_declaration (identifier) @name)
|
||||
name: (_) @name)
|
||||
alias: (_) @alias)
|
||||
|
||||
(use_as_clause
|
||||
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
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue