mirror of
https://github.com/nvim-treesitter/nvim-treesitter
synced 2024-09-16 14:34:05 +02:00
refactor(format): drop extra indentation for field
This commit is contained in:
parent
c28396de30
commit
722617e672
140 changed files with 2146 additions and 2766 deletions
|
@ -12,9 +12,8 @@
|
|||
name: (identifier) @function)
|
||||
|
||||
(pipe_call
|
||||
arguments:
|
||||
(pipe_arguments
|
||||
(identifier) @variable.parameter))
|
||||
arguments: (pipe_arguments
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(structural_directive
|
||||
"*" @keyword
|
||||
|
@ -47,14 +46,12 @@
|
|||
function: (identifier) @function)
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
((identifier) @function.builtin
|
||||
(#eq? @function.builtin "$any")))
|
||||
function: ((identifier) @function.builtin
|
||||
(#eq? @function.builtin "$any")))
|
||||
|
||||
(pair
|
||||
key:
|
||||
((identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "$implicit")))
|
||||
key: ((identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "$implicit")))
|
||||
|
||||
((control_keyword) @keyword.repeat
|
||||
(#any-of? @keyword.repeat "for" "empty"))
|
||||
|
|
|
@ -106,36 +106,34 @@
|
|||
] @operator
|
||||
|
||||
(binary_expression
|
||||
operator:
|
||||
[
|
||||
">"
|
||||
"<"
|
||||
"=="
|
||||
"==="
|
||||
"!=="
|
||||
"&&"
|
||||
"||"
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"&"
|
||||
"|"
|
||||
"^"
|
||||
"%"
|
||||
"<<"
|
||||
">>"
|
||||
">>>"
|
||||
] @operator)
|
||||
operator: [
|
||||
">"
|
||||
"<"
|
||||
"=="
|
||||
"==="
|
||||
"!=="
|
||||
"&&"
|
||||
"||"
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"&"
|
||||
"|"
|
||||
"^"
|
||||
"%"
|
||||
"<<"
|
||||
">>"
|
||||
">>>"
|
||||
] @operator)
|
||||
|
||||
(unary_expression
|
||||
operator:
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"!"
|
||||
"~"
|
||||
]) @operator
|
||||
operator: [
|
||||
"+"
|
||||
"-"
|
||||
"!"
|
||||
"~"
|
||||
]) @operator
|
||||
|
||||
(map_initializer
|
||||
"=>" @operator)
|
||||
|
@ -147,9 +145,8 @@
|
|||
|
||||
; Fields
|
||||
(field_declaration
|
||||
declarator:
|
||||
(variable_declarator
|
||||
name: (identifier) @variable.member))
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @variable.member))
|
||||
|
||||
(field_access
|
||||
field: (identifier) @variable.member)
|
||||
|
|
|
@ -48,9 +48,8 @@
|
|||
name: (identifier) @local.definition.method)
|
||||
|
||||
(local_variable_declaration
|
||||
declarator:
|
||||
(variable_declarator
|
||||
name: (identifier) @local.definition.var))
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @local.definition.var))
|
||||
|
||||
(enhanced_for_statement
|
||||
name: (identifier) @local.definition.var)
|
||||
|
@ -62,9 +61,8 @@
|
|||
name: (identifier) @local.definition.parameter)
|
||||
|
||||
(field_declaration
|
||||
declarator:
|
||||
(variable_declarator
|
||||
name: (identifier) @local.definition.field))
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @local.definition.field))
|
||||
|
||||
; REFERENCES
|
||||
(identifier) @local.reference
|
||||
|
|
|
@ -25,10 +25,9 @@
|
|||
(identifier) @property)
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(selector_expression
|
||||
operand: (identifier) @constant
|
||||
field: (field_identifier) @function.method))
|
||||
function: (selector_expression
|
||||
operand: (identifier) @constant
|
||||
field: (field_identifier) @function.method))
|
||||
|
||||
(perm_expression
|
||||
(stabby) @operator
|
||||
|
|
|
@ -41,14 +41,12 @@
|
|||
"::" @punctuation.delimiter)
|
||||
|
||||
(func_def
|
||||
name:
|
||||
(_
|
||||
(identifier) @function) @function)
|
||||
name: (_
|
||||
(identifier) @function) @function)
|
||||
|
||||
(func_call
|
||||
name:
|
||||
(_
|
||||
(identifier) @function) @function)
|
||||
name: (_
|
||||
(identifier) @function) @function)
|
||||
|
||||
(func_def
|
||||
(param_list
|
||||
|
|
|
@ -170,12 +170,11 @@
|
|||
"trap" "type" "typeset" "ulimit" "umask" "unalias" "wait"))
|
||||
|
||||
(command
|
||||
argument:
|
||||
[
|
||||
(word) @variable.parameter
|
||||
(concatenation
|
||||
(word) @variable.parameter)
|
||||
])
|
||||
argument: [
|
||||
(word) @variable.parameter
|
||||
(concatenation
|
||||
(word) @variable.parameter)
|
||||
])
|
||||
|
||||
(number) @number
|
||||
|
||||
|
|
|
@ -13,11 +13,10 @@
|
|||
((command
|
||||
name: (command_name) @_command
|
||||
.
|
||||
argument:
|
||||
[
|
||||
(string)
|
||||
(raw_string)
|
||||
] @injection.content)
|
||||
argument: [
|
||||
(string)
|
||||
(raw_string)
|
||||
] @injection.content)
|
||||
(#eq? @_command "printf")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
|
@ -28,11 +27,10 @@
|
|||
.
|
||||
(_)
|
||||
.
|
||||
argument:
|
||||
[
|
||||
(string)
|
||||
(raw_string)
|
||||
] @injection.content)
|
||||
argument: [
|
||||
(string)
|
||||
(raw_string)
|
||||
] @injection.content)
|
||||
(#eq? @_command "printf")
|
||||
(#eq? @_arg "-v")
|
||||
(#set! injection.language "printf"))
|
||||
|
@ -42,11 +40,10 @@
|
|||
name: (command_name) @_command
|
||||
argument: (word) @_arg
|
||||
.
|
||||
argument:
|
||||
[
|
||||
(string)
|
||||
(raw_string)
|
||||
] @injection.content)
|
||||
argument: [
|
||||
(string)
|
||||
(raw_string)
|
||||
] @injection.content)
|
||||
(#eq? @_command "printf")
|
||||
(#eq? @_arg "--")
|
||||
(#set! injection.language "printf"))
|
||||
|
|
|
@ -137,9 +137,8 @@
|
|||
|
||||
((assignment
|
||||
left: (python_identifier) @type.definition
|
||||
right:
|
||||
(call
|
||||
function: (python_identifier) @_func))
|
||||
right: (call
|
||||
function: (python_identifier) @_func))
|
||||
(#any-of? @_func "TypeVar" "NewType"))
|
||||
|
||||
; Fields
|
||||
|
@ -154,18 +153,16 @@
|
|||
function: (python_identifier) @function.call)
|
||||
|
||||
(call
|
||||
function:
|
||||
(attribute
|
||||
attribute: (python_identifier) @function.method.call))
|
||||
function: (attribute
|
||||
attribute: (python_identifier) @function.method.call))
|
||||
|
||||
((call
|
||||
function: (python_identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call
|
||||
function:
|
||||
(attribute
|
||||
attribute: (python_identifier) @constructor))
|
||||
function: (attribute
|
||||
attribute: (python_identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call
|
||||
|
@ -191,10 +188,9 @@
|
|||
|
||||
((call
|
||||
function: (python_identifier) @_isinstance
|
||||
arguments:
|
||||
(argument_list
|
||||
(_)
|
||||
(python_identifier) @type))
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
(python_identifier) @type))
|
||||
(#eq? @_isinstance "isinstance"))
|
||||
|
||||
(anonymous_python_function
|
||||
|
@ -216,11 +212,10 @@
|
|||
(identifier) @function)
|
||||
|
||||
(python_function_definition
|
||||
body:
|
||||
(block
|
||||
.
|
||||
(expression_statement
|
||||
(python_string) @string.documentation @spell)))
|
||||
body: (block
|
||||
.
|
||||
(expression_statement
|
||||
(python_string) @string.documentation @spell)))
|
||||
|
||||
; Namespace
|
||||
(inherit_path) @module
|
||||
|
|
|
@ -154,9 +154,8 @@
|
|||
(attribute
|
||||
attribute: (_) @indent.end)
|
||||
(call
|
||||
arguments:
|
||||
(_
|
||||
")" @indent.end))
|
||||
arguments: (_
|
||||
")" @indent.end))
|
||||
"return" @indent.end
|
||||
] .)
|
||||
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
(call
|
||||
function:
|
||||
(attribute
|
||||
object: (python_identifier) @_re)
|
||||
arguments:
|
||||
(argument_list
|
||||
(python_string
|
||||
(string_content) @injection.content) @_string)
|
||||
function: (attribute
|
||||
object: (python_identifier) @_re)
|
||||
arguments: (argument_list
|
||||
(python_string
|
||||
(string_content) @injection.content) @_string)
|
||||
(#eq? @_re "re")
|
||||
(#lua-match? @_string "^r.*")
|
||||
(#set! injection.language "regex"))
|
||||
|
|
|
@ -9,14 +9,12 @@
|
|||
alias: (python_identifier) @local.definition.import)
|
||||
|
||||
(import_statement
|
||||
name:
|
||||
(dotted_name
|
||||
(python_identifier) @local.definition.import))
|
||||
name: (dotted_name
|
||||
(python_identifier) @local.definition.import))
|
||||
|
||||
(import_from_statement
|
||||
name:
|
||||
(dotted_name
|
||||
(python_identifier) @local.definition.import))
|
||||
name: (dotted_name
|
||||
(python_identifier) @local.definition.import))
|
||||
|
||||
; Function with parameters, defines parameters
|
||||
(parameters
|
||||
|
@ -55,14 +53,12 @@
|
|||
; Loops
|
||||
; not a scope!
|
||||
(for_statement
|
||||
left:
|
||||
(pattern_list
|
||||
(python_identifier) @local.definition.var))
|
||||
left: (pattern_list
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(for_statement
|
||||
left:
|
||||
(tuple_pattern
|
||||
(python_identifier) @local.definition.var))
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(for_statement
|
||||
left: (python_identifier) @local.definition.var)
|
||||
|
@ -74,14 +70,12 @@
|
|||
left: (python_identifier) @local.definition.var)
|
||||
|
||||
(for_in_clause
|
||||
left:
|
||||
(tuple_pattern
|
||||
(python_identifier) @local.definition.var))
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(for_in_clause
|
||||
left:
|
||||
(pattern_list
|
||||
(python_identifier) @local.definition.var))
|
||||
left: (pattern_list
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(dictionary_comprehension) @local.scope
|
||||
|
||||
|
@ -94,30 +88,26 @@
|
|||
left: (python_identifier) @local.definition.var)
|
||||
|
||||
(assignment
|
||||
left:
|
||||
(pattern_list
|
||||
(python_identifier) @local.definition.var))
|
||||
left: (pattern_list
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(assignment
|
||||
left:
|
||||
(tuple_pattern
|
||||
(python_identifier) @local.definition.var))
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(assignment
|
||||
left:
|
||||
(attribute
|
||||
(python_identifier)
|
||||
(python_identifier) @local.definition.field))
|
||||
left: (attribute
|
||||
(python_identifier)
|
||||
(python_identifier) @local.definition.field))
|
||||
|
||||
(variable_assignment
|
||||
(identifier)
|
||||
operator:
|
||||
[
|
||||
"="
|
||||
"?="
|
||||
"??="
|
||||
":="
|
||||
] @local.definition.var)
|
||||
operator: [
|
||||
"="
|
||||
"?="
|
||||
"??="
|
||||
":="
|
||||
] @local.definition.var)
|
||||
|
||||
; Walrus operator x := 1
|
||||
(named_expression
|
||||
|
|
|
@ -263,18 +263,16 @@
|
|||
function: (identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
|
||||
(function_declarator
|
||||
declarator: (identifier) @function)
|
||||
|
||||
(function_declarator
|
||||
declarator:
|
||||
(parenthesized_declarator
|
||||
(pointer_declarator
|
||||
declarator: (field_identifier) @function)))
|
||||
declarator: (parenthesized_declarator
|
||||
(pointer_declarator
|
||||
declarator: (field_identifier) @function)))
|
||||
|
||||
(preproc_function_def
|
||||
name: (identifier) @function.macro)
|
||||
|
|
|
@ -43,19 +43,17 @@
|
|||
|
||||
; Supports if without braces (but not both if-else without braces)
|
||||
(if_statement
|
||||
consequence:
|
||||
(_
|
||||
";" @indent.end) @_consequence
|
||||
consequence: (_
|
||||
";" @indent.end) @_consequence
|
||||
(#not-has-type? @_consequence compound_statement)
|
||||
alternative:
|
||||
(else_clause
|
||||
"else" @indent.branch
|
||||
[
|
||||
(if_statement
|
||||
(compound_statement) @indent.dedent)? @indent.dedent
|
||||
(compound_statement)? @indent.dedent
|
||||
(_)? @indent.dedent
|
||||
])?) @indent.begin
|
||||
alternative: (else_clause
|
||||
"else" @indent.branch
|
||||
[
|
||||
(if_statement
|
||||
(compound_statement) @indent.dedent)? @indent.dedent
|
||||
(compound_statement)? @indent.dedent
|
||||
(_)? @indent.dedent
|
||||
])?) @indent.begin
|
||||
|
||||
(else_clause
|
||||
(_
|
||||
|
|
|
@ -14,11 +14,10 @@
|
|||
|
||||
((call_expression
|
||||
function: (identifier) @_function
|
||||
arguments:
|
||||
(argument_list
|
||||
.
|
||||
(string_literal
|
||||
(string_content) @injection.content)))
|
||||
arguments: (argument_list
|
||||
.
|
||||
(string_literal
|
||||
(string_content) @injection.content)))
|
||||
; format-ignore
|
||||
(#any-of? @_function
|
||||
"printf" "printf_s"
|
||||
|
@ -36,12 +35,11 @@
|
|||
|
||||
((call_expression
|
||||
function: (identifier) @_function
|
||||
arguments:
|
||||
(argument_list
|
||||
(_)
|
||||
.
|
||||
(string_literal
|
||||
(string_content) @injection.content)))
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
.
|
||||
(string_literal
|
||||
(string_content) @injection.content)))
|
||||
; format-ignore
|
||||
(#any-of? @_function
|
||||
"fprintf" "fprintf_s"
|
||||
|
@ -68,14 +66,13 @@
|
|||
|
||||
((call_expression
|
||||
function: (identifier) @_function
|
||||
arguments:
|
||||
(argument_list
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string_literal
|
||||
(string_content) @injection.content)))
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string_literal
|
||||
(string_content) @injection.content)))
|
||||
; format-ignore
|
||||
(#any-of? @_function
|
||||
"sprintf_s"
|
||||
|
@ -92,16 +89,15 @@
|
|||
|
||||
((call_expression
|
||||
function: (identifier) @_function
|
||||
arguments:
|
||||
(argument_list
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string_literal
|
||||
(string_content) @injection.content)))
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string_literal
|
||||
(string_content) @injection.content)))
|
||||
(#any-of? @_function "mvwprintw" "mvwscanw")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
body:
|
||||
[
|
||||
(declaration_list)
|
||||
(switch_body)
|
||||
(enum_member_declaration_list)
|
||||
] @fold
|
||||
body: [
|
||||
(declaration_list)
|
||||
(switch_body)
|
||||
(enum_member_declaration_list)
|
||||
] @fold
|
||||
|
||||
accessors: (accessor_list) @fold
|
||||
|
||||
|
|
|
@ -32,28 +32,25 @@
|
|||
name: (identifier) @function.method.call))
|
||||
|
||||
(invocation_expression
|
||||
function:
|
||||
(conditional_access_expression
|
||||
(member_binding_expression
|
||||
name: (identifier) @function.method.call)))
|
||||
function: (conditional_access_expression
|
||||
(member_binding_expression
|
||||
name: (identifier) @function.method.call)))
|
||||
|
||||
(namespace_declaration
|
||||
name:
|
||||
[
|
||||
(qualified_name)
|
||||
(identifier)
|
||||
] @module)
|
||||
name: [
|
||||
(qualified_name)
|
||||
(identifier)
|
||||
] @module)
|
||||
|
||||
(qualified_name
|
||||
(identifier) @type)
|
||||
|
||||
(namespace_declaration
|
||||
name:
|
||||
[
|
||||
(qualified_name
|
||||
(identifier) @module)
|
||||
(identifier) @module
|
||||
])
|
||||
name: [
|
||||
(qualified_name
|
||||
(identifier) @module)
|
||||
(identifier) @module
|
||||
])
|
||||
|
||||
(invocation_expression
|
||||
(identifier) @function.method.call)
|
||||
|
@ -184,16 +181,14 @@
|
|||
(identifier) @type))
|
||||
|
||||
(_
|
||||
type:
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
type: (generic_name
|
||||
(identifier) @type))
|
||||
|
||||
; Generic Method invocation with generic type
|
||||
(invocation_expression
|
||||
function:
|
||||
(generic_name
|
||||
.
|
||||
(identifier) @function.method.call))
|
||||
function: (generic_name
|
||||
.
|
||||
(identifier) @function.method.call))
|
||||
|
||||
(invocation_expression
|
||||
(member_access_expression
|
||||
|
|
|
@ -14,9 +14,8 @@
|
|||
left: (identifier) @local.definition.var)
|
||||
|
||||
(for_each_statement
|
||||
left:
|
||||
(tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
left: (tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(parameter
|
||||
(identifier) @local.definition.parameter)
|
||||
|
|
|
@ -10,9 +10,8 @@
|
|||
"from"
|
||||
"import"
|
||||
] @keyword.import
|
||||
module_name:
|
||||
(dotted_name
|
||||
(identifier) @module .))
|
||||
module_name: (dotted_name
|
||||
(identifier) @module .))
|
||||
|
||||
[
|
||||
"as"
|
||||
|
@ -74,9 +73,8 @@
|
|||
path: (identifier) @module)
|
||||
|
||||
(scoped_use_list
|
||||
path:
|
||||
(scoped_identifier
|
||||
(identifier) @module))
|
||||
path: (scoped_identifier
|
||||
(identifier) @module))
|
||||
|
||||
(use_list
|
||||
(scoped_identifier
|
||||
|
@ -228,14 +226,12 @@
|
|||
function: (identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(scoped_identifier
|
||||
(identifier) @function.call .))
|
||||
function: (scoped_identifier
|
||||
(identifier) @function.call .))
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
|
||||
"jmp" @function.builtin
|
||||
|
||||
|
@ -267,23 +263,20 @@
|
|||
name: (identifier) @constant)
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
function: (scoped_identifier
|
||||
"::"
|
||||
name: (identifier) @constant)
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((match_arm
|
||||
pattern: (match_pattern
|
||||
(identifier) @constant))
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((match_arm
|
||||
pattern: (match_pattern
|
||||
(scoped_identifier
|
||||
"::"
|
||||
name: (identifier) @constant)
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((match_arm
|
||||
pattern:
|
||||
(match_pattern
|
||||
(identifier) @constant))
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((match_arm
|
||||
pattern:
|
||||
(match_pattern
|
||||
(scoped_identifier
|
||||
name: (identifier) @constant)))
|
||||
name: (identifier) @constant)))
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
|
|
|
@ -25,29 +25,24 @@
|
|||
"}" @indent.end)
|
||||
|
||||
(enum_item
|
||||
body:
|
||||
(enum_variant_list
|
||||
"}" @indent.end))
|
||||
body: (enum_variant_list
|
||||
"}" @indent.end))
|
||||
|
||||
(match_expression
|
||||
body:
|
||||
(match_block
|
||||
"}" @indent.end))
|
||||
body: (match_block
|
||||
"}" @indent.end))
|
||||
|
||||
(mod_item
|
||||
body:
|
||||
(declaration_list
|
||||
"}" @indent.end))
|
||||
body: (declaration_list
|
||||
"}" @indent.end))
|
||||
|
||||
(struct_item
|
||||
body:
|
||||
(field_declaration_list
|
||||
"}" @indent.end))
|
||||
body: (field_declaration_list
|
||||
"}" @indent.end))
|
||||
|
||||
(trait_item
|
||||
body:
|
||||
(declaration_list
|
||||
"}" @indent.end))
|
||||
body: (declaration_list
|
||||
"}" @indent.end))
|
||||
|
||||
[
|
||||
")"
|
||||
|
|
|
@ -22,9 +22,8 @@
|
|||
] @local.scope
|
||||
|
||||
(use_declaration
|
||||
argument:
|
||||
(scoped_identifier
|
||||
name: (identifier) @local.definition.import))
|
||||
argument: (scoped_identifier
|
||||
name: (identifier) @local.definition.import))
|
||||
|
||||
(use_as_clause
|
||||
alias: (identifier) @local.definition.import)
|
||||
|
|
|
@ -11,30 +11,26 @@
|
|||
function_name: (_) @function)
|
||||
|
||||
(defun_header
|
||||
lambda_list:
|
||||
(list_lit
|
||||
(sym_lit) @variable.parameter))
|
||||
lambda_list: (list_lit
|
||||
(sym_lit) @variable.parameter))
|
||||
|
||||
(defun_header
|
||||
keyword:
|
||||
(defun_keyword
|
||||
"defmethod")
|
||||
lambda_list:
|
||||
keyword: (defun_keyword
|
||||
"defmethod")
|
||||
lambda_list: (list_lit
|
||||
(list_lit
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit)
|
||||
.
|
||||
(sym_lit) @string.special.symbol)))
|
||||
.
|
||||
(sym_lit)
|
||||
.
|
||||
(sym_lit) @string.special.symbol)))
|
||||
|
||||
(defun_header
|
||||
lambda_list:
|
||||
lambda_list: (list_lit
|
||||
(list_lit
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @variable.parameter
|
||||
.
|
||||
(_))))
|
||||
.
|
||||
(sym_lit) @variable.parameter
|
||||
.
|
||||
(_))))
|
||||
|
||||
(defun_header
|
||||
specifier: (sym_lit) @string.special.symbol)
|
||||
|
|
|
@ -3,30 +3,26 @@
|
|||
(#set! definition.function.scope "parent"))
|
||||
|
||||
(defun_header
|
||||
lambda_list:
|
||||
(list_lit
|
||||
(sym_lit) @local.definition.parameter))
|
||||
lambda_list: (list_lit
|
||||
(sym_lit) @local.definition.parameter))
|
||||
|
||||
(defun_header
|
||||
keyword:
|
||||
(defun_keyword
|
||||
"defmethod")
|
||||
lambda_list:
|
||||
keyword: (defun_keyword
|
||||
"defmethod")
|
||||
lambda_list: (list_lit
|
||||
(list_lit
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit)
|
||||
.
|
||||
(sym_lit) @local.definition.type)))
|
||||
.
|
||||
(sym_lit)
|
||||
.
|
||||
(sym_lit) @local.definition.type)))
|
||||
|
||||
(defun_header
|
||||
lambda_list:
|
||||
lambda_list: (list_lit
|
||||
(list_lit
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @local.definition.parameter
|
||||
.
|
||||
(_))))
|
||||
.
|
||||
(sym_lit) @local.definition.parameter
|
||||
.
|
||||
(_))))
|
||||
|
||||
(sym_lit) @local.reference
|
||||
|
||||
|
|
|
@ -8,9 +8,8 @@
|
|||
|
||||
; function(Foo ...foo)
|
||||
(variadic_parameter_declaration
|
||||
declarator:
|
||||
(variadic_declarator
|
||||
(_) @variable.parameter))
|
||||
declarator: (variadic_declarator
|
||||
(_) @variable.parameter))
|
||||
|
||||
; int foo = 0
|
||||
(optional_parameter_declaration
|
||||
|
@ -44,9 +43,8 @@
|
|||
(#lua-match? @type "^[%u]"))
|
||||
|
||||
(case_statement
|
||||
value:
|
||||
(qualified_identifier
|
||||
(identifier) @constant))
|
||||
value: (qualified_identifier
|
||||
(identifier) @constant))
|
||||
|
||||
(using_declaration
|
||||
.
|
||||
|
@ -167,15 +165,13 @@
|
|||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call_expression
|
||||
function:
|
||||
(qualified_identifier
|
||||
name: (identifier) @constructor))
|
||||
function: (qualified_identifier
|
||||
name: (identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call_expression
|
||||
function:
|
||||
(field_expression
|
||||
field: (field_identifier) @constructor))
|
||||
function: (field_expression
|
||||
field: (field_identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
; constructing a type in an initializer list: Constructor (): **SuperType (1)**
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
; Parameters
|
||||
(variadic_parameter_declaration
|
||||
declarator:
|
||||
(variadic_declarator
|
||||
(identifier) @local.definition.parameter))
|
||||
declarator: (variadic_declarator
|
||||
(identifier) @local.definition.parameter))
|
||||
|
||||
(optional_parameter_declaration
|
||||
declarator: (identifier) @local.definition.parameter)
|
||||
|
@ -19,9 +18,8 @@
|
|||
(identifier) @local.definition.var)
|
||||
|
||||
(struct_specifier
|
||||
name:
|
||||
(qualified_identifier
|
||||
name: (type_identifier) @local.definition.type))
|
||||
name: (qualified_identifier
|
||||
name: (type_identifier) @local.definition.type))
|
||||
|
||||
(class_specifier
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
@ -30,9 +28,8 @@
|
|||
name: (identifier) @local.definition.type)
|
||||
|
||||
(class_specifier
|
||||
name:
|
||||
(qualified_identifier
|
||||
name: (type_identifier) @local.definition.type))
|
||||
name: (qualified_identifier
|
||||
name: (type_identifier) @local.definition.type))
|
||||
|
||||
(alias_declaration
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
@ -63,14 +60,12 @@
|
|||
name: (field_identifier) @local.definition.method) @local.scope
|
||||
|
||||
(function_declarator
|
||||
declarator:
|
||||
(qualified_identifier
|
||||
name: (identifier) @local.definition.function)) @local.scope
|
||||
declarator: (qualified_identifier
|
||||
name: (identifier) @local.definition.function)) @local.scope
|
||||
|
||||
(field_declaration
|
||||
declarator:
|
||||
(function_declarator
|
||||
(field_identifier) @local.definition.method))
|
||||
declarator: (function_declarator
|
||||
(field_identifier) @local.definition.method))
|
||||
|
||||
(lambda_expression) @local.scope
|
||||
|
||||
|
|
|
@ -71,10 +71,9 @@
|
|||
function: (identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(selector_expression
|
||||
(_)
|
||||
(identifier) @function.call))
|
||||
function: (selector_expression
|
||||
(_)
|
||||
(identifier) @function.call))
|
||||
|
||||
(call_expression
|
||||
function: (builtin_function) @function.call)
|
||||
|
|
|
@ -33,19 +33,16 @@
|
|||
] @punctuation.bracket
|
||||
|
||||
(subgraph
|
||||
id:
|
||||
(id
|
||||
(identifier) @module))
|
||||
id: (id
|
||||
(identifier) @module))
|
||||
|
||||
(attribute
|
||||
name:
|
||||
(id
|
||||
(identifier) @variable.member))
|
||||
name: (id
|
||||
(identifier) @variable.member))
|
||||
|
||||
(attribute
|
||||
value:
|
||||
(id
|
||||
(identifier) @constant))
|
||||
value: (id
|
||||
(identifier) @constant))
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
|
|
|
@ -58,11 +58,10 @@
|
|||
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
|
||||
|
@ -77,15 +76,13 @@
|
|||
value: (arrow_function))
|
||||
|
||||
(assignment_expression
|
||||
left:
|
||||
(member_expression
|
||||
property: (property_identifier) @function.method)
|
||||
left: (member_expression
|
||||
property: (property_identifier) @function.method)
|
||||
right: (arrow_function))
|
||||
|
||||
(assignment_expression
|
||||
left:
|
||||
(member_expression
|
||||
property: (property_identifier) @function.method)
|
||||
left: (member_expression
|
||||
property: (property_identifier) @function.method)
|
||||
right: (function_expression))
|
||||
|
||||
(variable_declarator
|
||||
|
@ -110,13 +107,11 @@
|
|||
function: (identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(member_expression
|
||||
property:
|
||||
[
|
||||
(property_identifier)
|
||||
(private_property_identifier)
|
||||
] @function.method.call))
|
||||
function: (member_expression
|
||||
property: [
|
||||
(property_identifier)
|
||||
(private_property_identifier)
|
||||
] @function.method.call))
|
||||
|
||||
; Builtins
|
||||
;---------
|
||||
|
|
|
@ -8,12 +8,11 @@
|
|||
; html(`...`), html`...`, sql(...) etc
|
||||
(call_expression
|
||||
function: (identifier) @injection.language
|
||||
arguments:
|
||||
[
|
||||
(arguments
|
||||
(template_string) @injection.content)
|
||||
(template_string) @injection.content
|
||||
]
|
||||
arguments: [
|
||||
(arguments
|
||||
(template_string) @injection.content)
|
||||
(template_string) @injection.content
|
||||
]
|
||||
(#lua-match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*$")
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
|
@ -24,38 +23,32 @@
|
|||
|
||||
; svg`...` or svg(`...`)
|
||||
(call_expression
|
||||
function:
|
||||
((identifier) @_name
|
||||
(#eq? @_name "svg"))
|
||||
arguments:
|
||||
[
|
||||
(arguments
|
||||
(template_string) @injection.content)
|
||||
(template_string) @injection.content
|
||||
]
|
||||
function: ((identifier) @_name
|
||||
(#eq? @_name "svg"))
|
||||
arguments: [
|
||||
(arguments
|
||||
(template_string) @injection.content)
|
||||
(template_string) @injection.content
|
||||
]
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "html"))
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
((identifier) @_name
|
||||
(#eq? @_name "gql"))
|
||||
arguments:
|
||||
((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "graphql")))
|
||||
function: ((identifier) @_name
|
||||
(#eq? @_name "gql"))
|
||||
arguments: ((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "graphql")))
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
((identifier) @_name
|
||||
(#eq? @_name "hbs"))
|
||||
arguments:
|
||||
((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "glimmer")))
|
||||
function: ((identifier) @_name
|
||||
(#eq? @_name "hbs"))
|
||||
arguments: ((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "glimmer")))
|
||||
|
||||
((glimmer_template) @injection.content
|
||||
(#set! injection.language "glimmer"))
|
||||
|
@ -64,67 +57,54 @@
|
|||
(call_expression
|
||||
function: (identifier) @_name
|
||||
(#any-of? @_name "css" "keyframes")
|
||||
arguments:
|
||||
((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "styled")))
|
||||
arguments: ((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "styled")))
|
||||
|
||||
; styled.div`<css>`
|
||||
(call_expression
|
||||
function:
|
||||
(member_expression
|
||||
object: (identifier) @_name
|
||||
(#eq? @_name "styled"))
|
||||
arguments:
|
||||
((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "styled")))
|
||||
function: (member_expression
|
||||
object: (identifier) @_name
|
||||
(#eq? @_name "styled"))
|
||||
arguments: ((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "styled")))
|
||||
|
||||
; styled(Component)`<css>`
|
||||
(call_expression
|
||||
function:
|
||||
(call_expression
|
||||
function: (identifier) @_name
|
||||
(#eq? @_name "styled"))
|
||||
arguments:
|
||||
((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "styled")))
|
||||
function: (call_expression
|
||||
function: (identifier) @_name
|
||||
(#eq? @_name "styled"))
|
||||
arguments: ((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "styled")))
|
||||
|
||||
; styled.div.attrs({ prop: "foo" })`<css>`
|
||||
(call_expression
|
||||
function:
|
||||
(call_expression
|
||||
function:
|
||||
(member_expression
|
||||
object:
|
||||
(member_expression
|
||||
object: (identifier) @_name
|
||||
(#eq? @_name "styled"))))
|
||||
arguments:
|
||||
((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "styled")))
|
||||
function: (call_expression
|
||||
function: (member_expression
|
||||
object: (member_expression
|
||||
object: (identifier) @_name
|
||||
(#eq? @_name "styled"))))
|
||||
arguments: ((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "styled")))
|
||||
|
||||
; styled(Component).attrs({ prop: "foo" })`<css>`
|
||||
(call_expression
|
||||
function:
|
||||
(call_expression
|
||||
function:
|
||||
(member_expression
|
||||
object:
|
||||
(call_expression
|
||||
function: (identifier) @_name
|
||||
(#eq? @_name "styled"))))
|
||||
arguments:
|
||||
((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "styled")))
|
||||
function: (call_expression
|
||||
function: (member_expression
|
||||
object: (call_expression
|
||||
function: (identifier) @_name
|
||||
(#eq? @_name "styled"))))
|
||||
arguments: ((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "styled")))
|
||||
|
||||
((regex_pattern) @injection.content
|
||||
(#set! injection.language "regex"))
|
||||
|
@ -141,10 +121,9 @@
|
|||
|
||||
; el.innerHTML = `<html>`
|
||||
(assignment_expression
|
||||
left:
|
||||
(member_expression
|
||||
property: (property_identifier) @_prop
|
||||
(#any-of? @_prop "outerHTML" "innerHTML"))
|
||||
left: (member_expression
|
||||
property: (property_identifier) @_prop
|
||||
(#any-of? @_prop "outerHTML" "innerHTML"))
|
||||
right: (template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
|
@ -152,13 +131,11 @@
|
|||
|
||||
; el.innerHTML = '<html>'
|
||||
(assignment_expression
|
||||
left:
|
||||
(member_expression
|
||||
property: (property_identifier) @_prop
|
||||
(#any-of? @_prop "outerHTML" "innerHTML"))
|
||||
right:
|
||||
(string
|
||||
(string_fragment) @injection.content)
|
||||
left: (member_expression
|
||||
property: (property_identifier) @_prop
|
||||
(#any-of? @_prop "outerHTML" "innerHTML"))
|
||||
right: (string
|
||||
(string_fragment) @injection.content)
|
||||
(#set! injection.language "html"))
|
||||
|
||||
;---- Angular injections -----
|
||||
|
@ -167,61 +144,49 @@
|
|||
; })
|
||||
(decorator
|
||||
(call_expression
|
||||
function:
|
||||
((identifier) @_name
|
||||
(#eq? @_name "Component"))
|
||||
arguments:
|
||||
(arguments
|
||||
(object
|
||||
(pair
|
||||
key:
|
||||
((property_identifier) @_prop
|
||||
(#eq? @_prop "template"))
|
||||
value:
|
||||
((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "angular")))))))
|
||||
function: ((identifier) @_name
|
||||
(#eq? @_name "Component"))
|
||||
arguments: (arguments
|
||||
(object
|
||||
(pair
|
||||
key: ((property_identifier) @_prop
|
||||
(#eq? @_prop "template"))
|
||||
value: ((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "angular")))))))
|
||||
|
||||
; @Component({
|
||||
; styles: [`<css>`]
|
||||
; })
|
||||
(decorator
|
||||
(call_expression
|
||||
function:
|
||||
((identifier) @_name
|
||||
(#eq? @_name "Component"))
|
||||
arguments:
|
||||
(arguments
|
||||
(object
|
||||
(pair
|
||||
key:
|
||||
((property_identifier) @_prop
|
||||
(#eq? @_prop "styles"))
|
||||
value:
|
||||
(array
|
||||
((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "css"))))))))
|
||||
function: ((identifier) @_name
|
||||
(#eq? @_name "Component"))
|
||||
arguments: (arguments
|
||||
(object
|
||||
(pair
|
||||
key: ((property_identifier) @_prop
|
||||
(#eq? @_prop "styles"))
|
||||
value: (array
|
||||
((template_string) @injection.content
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "css"))))))))
|
||||
|
||||
; @Component({
|
||||
; styles: `<css>`
|
||||
; })
|
||||
(decorator
|
||||
(call_expression
|
||||
function:
|
||||
((identifier) @_name
|
||||
(#eq? @_name "Component"))
|
||||
arguments:
|
||||
(arguments
|
||||
(object
|
||||
(pair
|
||||
key:
|
||||
((property_identifier) @_prop
|
||||
(#eq? @_prop "styles"))
|
||||
value:
|
||||
((template_string) @injection.content
|
||||
(#set! injection.include-children)
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.language "css")))))))
|
||||
function: ((identifier) @_name
|
||||
(#eq? @_name "Component"))
|
||||
arguments: (arguments
|
||||
(object
|
||||
(pair
|
||||
key: ((property_identifier) @_prop
|
||||
(#eq? @_prop "styles"))
|
||||
value: ((template_string) @injection.content
|
||||
(#set! injection.include-children)
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.language "css")))))))
|
||||
|
|
|
@ -95,42 +95,37 @@
|
|||
|
||||
; Remote Function Calls
|
||||
(call
|
||||
target:
|
||||
(dot
|
||||
left:
|
||||
[
|
||||
(atom) @type
|
||||
(_)
|
||||
]
|
||||
right: (identifier) @function.call)
|
||||
target: (dot
|
||||
left: [
|
||||
(atom) @type
|
||||
(_)
|
||||
]
|
||||
right: (identifier) @function.call)
|
||||
(arguments))
|
||||
|
||||
; Definition Function Calls
|
||||
(call
|
||||
target:
|
||||
((identifier) @keyword.function
|
||||
(#any-of? @keyword.function
|
||||
"def" "defdelegate" "defexception" "defguard" "defguardp" "defimpl" "defmacro" "defmacrop"
|
||||
"defmodule" "defn" "defnp" "defoverridable" "defp" "defprotocol" "defstruct"))
|
||||
target: ((identifier) @keyword.function
|
||||
(#any-of? @keyword.function
|
||||
"def" "defdelegate" "defexception" "defguard" "defguardp" "defimpl" "defmacro" "defmacrop"
|
||||
"defmodule" "defn" "defnp" "defoverridable" "defp" "defprotocol" "defstruct"))
|
||||
(arguments
|
||||
[
|
||||
(call
|
||||
(identifier) @function)
|
||||
(identifier) @function
|
||||
(binary_operator
|
||||
left:
|
||||
(call
|
||||
target: (identifier) @function)
|
||||
left: (call
|
||||
target: (identifier) @function)
|
||||
operator: "when")
|
||||
])?)
|
||||
|
||||
; Kernel Keywords & Special Forms
|
||||
(call
|
||||
target:
|
||||
((identifier) @keyword
|
||||
(#any-of? @keyword
|
||||
"alias" "case" "catch" "cond" "else" "for" "if" "import" "quote" "raise" "receive" "require"
|
||||
"reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with")))
|
||||
target: ((identifier) @keyword
|
||||
(#any-of? @keyword
|
||||
"alias" "case" "catch" "cond" "else" "for" "if" "import" "quote" "raise" "receive" "require"
|
||||
"reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with")))
|
||||
|
||||
; Special Constants
|
||||
((identifier) @constant.builtin
|
||||
|
@ -160,22 +155,19 @@
|
|||
; Capture Operator
|
||||
(unary_operator
|
||||
operator: "&"
|
||||
operand:
|
||||
[
|
||||
(integer) @operator
|
||||
(binary_operator
|
||||
left:
|
||||
[
|
||||
(call
|
||||
target:
|
||||
(dot
|
||||
left: (_)
|
||||
right: (identifier) @function))
|
||||
(identifier) @function
|
||||
]
|
||||
operator: "/"
|
||||
right: (integer) @operator)
|
||||
])
|
||||
operand: [
|
||||
(integer) @operator
|
||||
(binary_operator
|
||||
left: [
|
||||
(call
|
||||
target: (dot
|
||||
left: (_)
|
||||
right: (identifier) @function))
|
||||
(identifier) @function
|
||||
]
|
||||
operator: "/"
|
||||
right: (integer) @operator)
|
||||
])
|
||||
|
||||
; Non-String Sigils
|
||||
(sigil
|
||||
|
@ -199,30 +191,27 @@
|
|||
; Module attributes
|
||||
(unary_operator
|
||||
operator: "@"
|
||||
operand:
|
||||
[
|
||||
(identifier)
|
||||
(call
|
||||
target: (identifier))
|
||||
] @constant) @constant
|
||||
operand: [
|
||||
(identifier)
|
||||
(call
|
||||
target: (identifier))
|
||||
] @constant) @constant
|
||||
|
||||
; Documentation
|
||||
(unary_operator
|
||||
operator: "@"
|
||||
operand:
|
||||
(call
|
||||
target:
|
||||
((identifier) @_identifier
|
||||
(#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) @comment.documentation
|
||||
(arguments
|
||||
[
|
||||
(string)
|
||||
(boolean)
|
||||
(charlist)
|
||||
(sigil
|
||||
"~" @comment.documentation
|
||||
(sigil_name) @comment.documentation
|
||||
quoted_start: _ @comment.documentation
|
||||
(quoted_content) @comment.documentation
|
||||
quoted_end: _ @comment.documentation)
|
||||
] @comment.documentation))) @comment.documentation
|
||||
operand: (call
|
||||
target: ((identifier) @_identifier
|
||||
(#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) @comment.documentation
|
||||
(arguments
|
||||
[
|
||||
(string)
|
||||
(boolean)
|
||||
(charlist)
|
||||
(sigil
|
||||
"~" @comment.documentation
|
||||
(sigil_name) @comment.documentation
|
||||
quoted_start: _ @comment.documentation
|
||||
(quoted_content) @comment.documentation
|
||||
quoted_end: _ @comment.documentation)
|
||||
] @comment.documentation))) @comment.documentation
|
||||
|
|
|
@ -5,19 +5,17 @@
|
|||
; Documentation
|
||||
(unary_operator
|
||||
operator: "@"
|
||||
operand:
|
||||
(call
|
||||
target:
|
||||
((identifier) @_identifier
|
||||
(#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc"))
|
||||
(arguments
|
||||
[
|
||||
(string
|
||||
(quoted_content) @injection.content)
|
||||
(sigil
|
||||
(quoted_content) @injection.content)
|
||||
])
|
||||
(#set! injection.language "markdown")))
|
||||
operand: (call
|
||||
target: ((identifier) @_identifier
|
||||
(#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc"))
|
||||
(arguments
|
||||
[
|
||||
(string
|
||||
(quoted_content) @injection.content)
|
||||
(sigil
|
||||
(quoted_content) @injection.content)
|
||||
])
|
||||
(#set! injection.language "markdown")))
|
||||
|
||||
; HEEx
|
||||
(sigil
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
|
||||
; Module Definitions
|
||||
(call
|
||||
target:
|
||||
((identifier) @_identifier
|
||||
(#eq? @_identifier "defmodule"))
|
||||
target: ((identifier) @_identifier
|
||||
(#eq? @_identifier "defmodule"))
|
||||
(arguments
|
||||
(alias) @local.definition.type))
|
||||
|
||||
|
|
|
@ -97,40 +97,34 @@
|
|||
; Functions
|
||||
;----------
|
||||
(value_declaration
|
||||
functionDeclarationLeft:
|
||||
(function_declaration_left
|
||||
(lower_case_identifier) @function
|
||||
(pattern)))
|
||||
functionDeclarationLeft: (function_declaration_left
|
||||
(lower_case_identifier) @function
|
||||
(pattern)))
|
||||
|
||||
(value_declaration
|
||||
functionDeclarationLeft:
|
||||
(function_declaration_left
|
||||
(lower_case_identifier) @function
|
||||
pattern: (_)))
|
||||
functionDeclarationLeft: (function_declaration_left
|
||||
(lower_case_identifier) @function
|
||||
pattern: (_)))
|
||||
|
||||
(value_declaration
|
||||
functionDeclarationLeft:
|
||||
(function_declaration_left
|
||||
(lower_case_identifier) @function)
|
||||
functionDeclarationLeft: (function_declaration_left
|
||||
(lower_case_identifier) @function)
|
||||
body: (anonymous_function_expr))
|
||||
|
||||
(type_annotation
|
||||
name: (lower_case_identifier) @function
|
||||
typeExpression:
|
||||
(type_expression
|
||||
(arrow)))
|
||||
typeExpression: (type_expression
|
||||
(arrow)))
|
||||
|
||||
(port_annotation
|
||||
name: (lower_case_identifier) @function
|
||||
typeExpression:
|
||||
(type_expression
|
||||
(arrow)))
|
||||
typeExpression: (type_expression
|
||||
(arrow)))
|
||||
|
||||
(function_call_expr
|
||||
target:
|
||||
(value_expr
|
||||
(value_qid
|
||||
(lower_case_identifier) @function.call)))
|
||||
target: (value_expr
|
||||
(value_qid
|
||||
(lower_case_identifier) @function.call)))
|
||||
|
||||
; Operators
|
||||
;----------
|
||||
|
|
|
@ -106,10 +106,9 @@
|
|||
(export_type_attribute) @type.definition
|
||||
|
||||
(export_type_attribute
|
||||
types:
|
||||
(fa
|
||||
fun: _ @type
|
||||
(#set! "priority" 101)))
|
||||
types: (fa
|
||||
fun: _ @type
|
||||
(#set! "priority" 101)))
|
||||
|
||||
(behaviour_attribute) @keyword.import
|
||||
|
||||
|
@ -117,9 +116,8 @@
|
|||
(atom) @module) @keyword.import
|
||||
|
||||
(wild_attribute
|
||||
name:
|
||||
(attr_name
|
||||
name: _ @attribute)) @attribute
|
||||
name: (attr_name
|
||||
name: _ @attribute)) @attribute
|
||||
|
||||
; Records
|
||||
(record_expr) @type
|
||||
|
@ -157,12 +155,11 @@
|
|||
|
||||
; expr_function_call
|
||||
(call
|
||||
expr:
|
||||
[
|
||||
(atom)
|
||||
(remote)
|
||||
(var)
|
||||
] @function)
|
||||
expr: [
|
||||
(atom)
|
||||
(remote)
|
||||
(var)
|
||||
] @function)
|
||||
|
||||
(call
|
||||
(atom) @keyword.exception
|
||||
|
@ -170,10 +167,9 @@
|
|||
|
||||
; Parenthesized expression: (SomeFunc)(), only highlight the parens
|
||||
(call
|
||||
expr:
|
||||
(paren_expr
|
||||
"(" @function.call
|
||||
")" @function.call))
|
||||
expr: (paren_expr
|
||||
"(" @function.call
|
||||
")" @function.call))
|
||||
|
||||
; function
|
||||
(external_fun) @function.call
|
||||
|
|
|
@ -35,12 +35,11 @@
|
|||
|
||||
; Types
|
||||
(_
|
||||
type:
|
||||
[
|
||||
(int_type)
|
||||
(float_type)
|
||||
(any_type)
|
||||
]) @type.builtin
|
||||
type: [
|
||||
(int_type)
|
||||
(float_type)
|
||||
(any_type)
|
||||
]) @type.builtin
|
||||
|
||||
[
|
||||
(single_precision)
|
||||
|
|
|
@ -27,9 +27,8 @@
|
|||
(#any-of? @_fn "fn" "lambda" "λ" "hashfn")) @fold
|
||||
|
||||
(reader_macro
|
||||
macro:
|
||||
[
|
||||
"'"
|
||||
"`"
|
||||
]
|
||||
macro: [
|
||||
"'"
|
||||
"`"
|
||||
]
|
||||
expression: (_) @fold)
|
||||
|
|
|
@ -42,14 +42,12 @@
|
|||
.
|
||||
(table
|
||||
(table_pair
|
||||
key:
|
||||
(string
|
||||
(string_content) @_command
|
||||
(#eq? @_command "command"))
|
||||
value:
|
||||
(string
|
||||
(string_content) @injection.content
|
||||
(#set! injection.language "vim")))))
|
||||
key: (string
|
||||
(string_content) @_command
|
||||
(#eq? @_command "command"))
|
||||
value: (string
|
||||
(string_content) @injection.content
|
||||
(#set! injection.language "vim")))))
|
||||
|
||||
(list
|
||||
.
|
||||
|
|
|
@ -98,11 +98,10 @@
|
|||
|
||||
; Commands
|
||||
(command
|
||||
argument:
|
||||
[
|
||||
(word) @variable.parameter
|
||||
(#lua-match? @variable.parameter "^[-]")
|
||||
])
|
||||
argument: [
|
||||
(word) @variable.parameter
|
||||
(#lua-match? @variable.parameter "^[-]")
|
||||
])
|
||||
|
||||
(command_substitution
|
||||
"$" @punctuation.bracket)
|
||||
|
@ -113,15 +112,14 @@
|
|||
|
||||
; derived from builtin -n (fish 3.2.2)
|
||||
(command
|
||||
name:
|
||||
[
|
||||
(word) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"." ":" "_" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" "command"
|
||||
"commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" "exit" "fg"
|
||||
"functions" "history" "isatty" "jobs" "math" "printf" "pwd" "random" "read" "realpath" "set"
|
||||
"set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait")
|
||||
])
|
||||
name: [
|
||||
(word) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"." ":" "_" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" "command"
|
||||
"commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" "exit" "fg"
|
||||
"functions" "history" "isatty" "jobs" "math" "printf" "pwd" "random" "read" "realpath" "set"
|
||||
"set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait")
|
||||
])
|
||||
|
||||
; Functions
|
||||
(function_definition
|
||||
|
@ -131,19 +129,17 @@
|
|||
] @keyword.function)
|
||||
|
||||
(function_definition
|
||||
name:
|
||||
[
|
||||
(word)
|
||||
(concatenation)
|
||||
] @function)
|
||||
name: [
|
||||
(word)
|
||||
(concatenation)
|
||||
] @function)
|
||||
|
||||
(function_definition
|
||||
option:
|
||||
[
|
||||
(word)
|
||||
(concatenation
|
||||
(word))
|
||||
] @variable.parameter
|
||||
option: [
|
||||
(word)
|
||||
(concatenation
|
||||
(word))
|
||||
] @variable.parameter
|
||||
(#lua-match? @variable.parameter "^[-]"))
|
||||
|
||||
; Strings
|
||||
|
|
|
@ -7,6 +7,5 @@
|
|||
keyword: (_) @local.definition.parameter)
|
||||
|
||||
(key_value
|
||||
value:
|
||||
(macro
|
||||
(identifier)*)* @local.reference)
|
||||
value: (macro
|
||||
(identifier)*)* @local.reference)
|
||||
|
|
|
@ -130,11 +130,10 @@
|
|||
member: (ident) @property)
|
||||
|
||||
(call_expr
|
||||
function:
|
||||
[
|
||||
(ident)
|
||||
(builtin_type)
|
||||
] @function)
|
||||
function: [
|
||||
(ident)
|
||||
(builtin_type)
|
||||
] @function)
|
||||
|
||||
(call_expr
|
||||
function: (builtin_type) @function.call)
|
||||
|
|
|
@ -21,10 +21,9 @@
|
|||
(section_header
|
||||
(section_name) @_alias)
|
||||
(variable
|
||||
value:
|
||||
(string
|
||||
"\""
|
||||
"\"") @injection.content)
|
||||
value: (string
|
||||
"\""
|
||||
"\"") @injection.content)
|
||||
(#eq? @_alias "alias")
|
||||
(#lua-match? @injection.content "^\"!")
|
||||
(#offset! @injection.content 0 2 0 -1)
|
||||
|
|
|
@ -92,8 +92,7 @@
|
|||
(module) @module
|
||||
|
||||
(import
|
||||
alias:
|
||||
((identifier) @module)?)
|
||||
alias: ((identifier) @module)?)
|
||||
|
||||
(remote_type_identifier
|
||||
module: (identifier) @module)
|
||||
|
@ -114,10 +113,9 @@
|
|||
|
||||
; Function Parameter Labels
|
||||
(function_call
|
||||
arguments:
|
||||
(arguments
|
||||
(argument
|
||||
label: (label) @label)))
|
||||
arguments: (arguments
|
||||
(argument
|
||||
label: (label) @label)))
|
||||
|
||||
(function_parameter
|
||||
label: (label)? @label
|
||||
|
@ -125,10 +123,9 @@
|
|||
|
||||
; Records
|
||||
(record
|
||||
arguments:
|
||||
(arguments
|
||||
(argument
|
||||
label: (label) @variable.member)?))
|
||||
arguments: (arguments
|
||||
(argument
|
||||
label: (label) @variable.member)?))
|
||||
|
||||
(record_pattern_argument
|
||||
label: (label) @variable.member)
|
||||
|
@ -173,9 +170,8 @@
|
|||
function: (identifier) @function.call)
|
||||
|
||||
(function_call
|
||||
function:
|
||||
(field_access
|
||||
field: (label) @function.call))
|
||||
function: (field_access
|
||||
field: (label) @function.call))
|
||||
|
||||
; External Functions
|
||||
(external_function
|
||||
|
|
|
@ -50,12 +50,11 @@
|
|||
|
||||
; As are arguments in a block statement
|
||||
(block_statement_start
|
||||
argument:
|
||||
[
|
||||
(path_expression
|
||||
(identifier) @variable)
|
||||
(identifier) @variable
|
||||
])
|
||||
argument: [
|
||||
(path_expression
|
||||
(identifier) @variable)
|
||||
(identifier) @variable
|
||||
])
|
||||
|
||||
; As is an identifier in a block param
|
||||
(block_params
|
||||
|
@ -63,12 +62,11 @@
|
|||
|
||||
; As are helper arguments
|
||||
((helper_invocation
|
||||
argument:
|
||||
[
|
||||
(path_expression
|
||||
(identifier) @variable)
|
||||
(identifier) @variable
|
||||
])
|
||||
argument: [
|
||||
(path_expression
|
||||
(identifier) @variable)
|
||||
(identifier) @variable
|
||||
])
|
||||
(#not-eq? @variable "this"))
|
||||
|
||||
; `this` should be highlighted as a built-in variable
|
||||
|
@ -82,12 +80,11 @@
|
|||
|
||||
; Helpers are functions
|
||||
((helper_invocation
|
||||
helper:
|
||||
[
|
||||
(path_expression
|
||||
(identifier) @function)
|
||||
(identifier) @function
|
||||
])
|
||||
helper: [
|
||||
(path_expression
|
||||
(identifier) @function)
|
||||
(identifier) @function
|
||||
])
|
||||
(#not-any-of? @function "if" "yield"))
|
||||
|
||||
((helper_invocation
|
||||
|
|
|
@ -29,9 +29,8 @@
|
|||
function: (identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(selector_expression
|
||||
field: (field_identifier) @function.method.call))
|
||||
function: (selector_expression
|
||||
field: (field_identifier) @function.method.call))
|
||||
|
||||
; Function definitions
|
||||
(function_declaration
|
||||
|
|
|
@ -20,24 +20,20 @@
|
|||
(#set! injection.language "re2c"))
|
||||
|
||||
((call_expression
|
||||
function:
|
||||
(selector_expression
|
||||
field: (field_identifier) @_method)
|
||||
arguments:
|
||||
(argument_list
|
||||
.
|
||||
(interpreted_string_literal) @injection.content))
|
||||
function: (selector_expression
|
||||
field: (field_identifier) @_method)
|
||||
arguments: (argument_list
|
||||
.
|
||||
(interpreted_string_literal) @injection.content))
|
||||
(#any-of? @_method "Printf" "Sprintf" "Fatalf" "Scanf" "Errorf" "Skipf" "Logf")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
((call_expression
|
||||
function:
|
||||
(selector_expression
|
||||
field: (field_identifier) @_method)
|
||||
arguments:
|
||||
(argument_list
|
||||
(_)
|
||||
.
|
||||
(interpreted_string_literal) @injection.content))
|
||||
function: (selector_expression
|
||||
field: (field_identifier) @_method)
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
.
|
||||
(interpreted_string_literal) @injection.content))
|
||||
(#any-of? @_method "Fprintf" "Fscanf" "Appendf" "Sscanf")
|
||||
(#set! injection.language "printf"))
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
)
|
||||
|
||||
(short_var_declaration
|
||||
left:
|
||||
(expression_list
|
||||
(identifier) @local.definition.var))
|
||||
left: (expression_list
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(var_spec
|
||||
name: (identifier) @local.definition.var)
|
||||
|
@ -22,9 +21,8 @@
|
|||
|
||||
(for_statement
|
||||
(range_clause
|
||||
left:
|
||||
(expression_list
|
||||
(identifier) @local.definition.var)))
|
||||
left: (expression_list
|
||||
(identifier) @local.definition.var)))
|
||||
|
||||
(const_declaration
|
||||
(const_spec
|
||||
|
@ -57,22 +55,19 @@
|
|||
(#set! reference.kind "call"))
|
||||
|
||||
((call_expression
|
||||
function:
|
||||
function: (selector_expression
|
||||
field: (field_identifier) @local.reference))
|
||||
(#set! reference.kind "call"))
|
||||
|
||||
((call_expression
|
||||
function: (parenthesized_expression
|
||||
(identifier) @local.reference))
|
||||
(#set! reference.kind "call"))
|
||||
|
||||
((call_expression
|
||||
function: (parenthesized_expression
|
||||
(selector_expression
|
||||
field: (field_identifier) @local.reference))
|
||||
(#set! reference.kind "call"))
|
||||
|
||||
((call_expression
|
||||
function:
|
||||
(parenthesized_expression
|
||||
(identifier) @local.reference))
|
||||
(#set! reference.kind "call"))
|
||||
|
||||
((call_expression
|
||||
function:
|
||||
(parenthesized_expression
|
||||
(selector_expression
|
||||
field: (field_identifier) @local.reference)))
|
||||
field: (field_identifier) @local.reference)))
|
||||
(#set! reference.kind "call"))
|
||||
|
||||
; Scopes
|
||||
|
|
|
@ -11,9 +11,8 @@
|
|||
function: (identifier) @function)
|
||||
|
||||
(method_call
|
||||
method:
|
||||
(selector_expression
|
||||
field: (field_identifier) @function))
|
||||
method: (selector_expression
|
||||
field: (field_identifier) @function))
|
||||
|
||||
; Builtin functions
|
||||
(function_call
|
||||
|
|
|
@ -4,20 +4,18 @@
|
|||
; {{"put" | printf "%s%s" "out" | printf "%q"}}
|
||||
(function_call
|
||||
function: (identifier) @_function
|
||||
arguments:
|
||||
(argument_list
|
||||
.
|
||||
(interpreted_string_literal) @injection.content)
|
||||
arguments: (argument_list
|
||||
.
|
||||
(interpreted_string_literal) @injection.content)
|
||||
(#eq? @_function "printf")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
; {{ js "var a = 1 + 1" }}
|
||||
(function_call
|
||||
function: (identifier) @_function
|
||||
arguments:
|
||||
(argument_list
|
||||
.
|
||||
(interpreted_string_literal) @injection.content)
|
||||
arguments: (argument_list
|
||||
.
|
||||
(interpreted_string_literal) @injection.content)
|
||||
(#eq? @_function "js")
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.language "javascript"))
|
||||
|
@ -25,10 +23,9 @@
|
|||
; {{ html "<h1>hello</h1>" }}
|
||||
(function_call
|
||||
function: (identifier) @_function
|
||||
arguments:
|
||||
(argument_list
|
||||
.
|
||||
(interpreted_string_literal) @injection.content)
|
||||
arguments: (argument_list
|
||||
.
|
||||
(interpreted_string_literal) @injection.content)
|
||||
(#eq? @_function "html")
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.language "html"))
|
||||
|
|
|
@ -215,9 +215,8 @@
|
|||
function: (identifier) @function)
|
||||
|
||||
(function_call
|
||||
function:
|
||||
(dotted_identifier
|
||||
(identifier) @function .))
|
||||
function: (dotted_identifier
|
||||
(identifier) @function .))
|
||||
|
||||
(function_call
|
||||
(argument_list
|
||||
|
@ -228,9 +227,8 @@
|
|||
function: (identifier) @function)
|
||||
|
||||
(juxt_function_call
|
||||
function:
|
||||
(dotted_identifier
|
||||
(identifier) @function .))
|
||||
function: (dotted_identifier
|
||||
(identifier) @function .))
|
||||
|
||||
(juxt_function_call
|
||||
(argument_list
|
||||
|
|
|
@ -195,20 +195,17 @@
|
|||
(variable) @variable.parameter)
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
function: (qualified_identifier
|
||||
(identifier) @function.call .))
|
||||
|
||||
(call_expression
|
||||
function: (scoped_identifier
|
||||
(identifier) @function.call .))
|
||||
|
||||
(call_expression
|
||||
function: (selection_expression
|
||||
(qualified_identifier
|
||||
(identifier) @function.call .))
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(scoped_identifier
|
||||
(identifier) @function.call .))
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(selection_expression
|
||||
(qualified_identifier
|
||||
(identifier) @function.method.call .)))
|
||||
(identifier) @function.method.call .)))
|
||||
|
||||
(qualified_identifier
|
||||
(_) @module
|
||||
|
|
|
@ -7,23 +7,20 @@
|
|||
(pat_wildcard) @variable
|
||||
|
||||
(function
|
||||
patterns:
|
||||
(patterns
|
||||
(_) @variable.parameter))
|
||||
patterns: (patterns
|
||||
(_) @variable.parameter))
|
||||
|
||||
(exp_lambda
|
||||
(_)+ @variable.parameter
|
||||
"->")
|
||||
|
||||
(function
|
||||
infix:
|
||||
(infix
|
||||
lhs: (_) @variable.parameter))
|
||||
infix: (infix
|
||||
lhs: (_) @variable.parameter))
|
||||
|
||||
(function
|
||||
infix:
|
||||
(infix
|
||||
rhs: (_) @variable.parameter))
|
||||
infix: (infix
|
||||
rhs: (_) @variable.parameter))
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; Literals and comments
|
||||
|
@ -185,7 +182,24 @@
|
|||
|
||||
(function
|
||||
name: (variable) @variable
|
||||
rhs:
|
||||
rhs: [
|
||||
(exp_literal)
|
||||
(exp_apply
|
||||
(exp_name
|
||||
[
|
||||
(constructor)
|
||||
(variable)
|
||||
(qualified_variable)
|
||||
]))
|
||||
(quasiquote)
|
||||
((exp_name)
|
||||
.
|
||||
(operator))
|
||||
])
|
||||
|
||||
(function
|
||||
name: (variable) @variable
|
||||
rhs: (exp_infix
|
||||
[
|
||||
(exp_literal)
|
||||
(exp_apply
|
||||
|
@ -199,26 +213,7 @@
|
|||
((exp_name)
|
||||
.
|
||||
(operator))
|
||||
])
|
||||
|
||||
(function
|
||||
name: (variable) @variable
|
||||
rhs:
|
||||
(exp_infix
|
||||
[
|
||||
(exp_literal)
|
||||
(exp_apply
|
||||
(exp_name
|
||||
[
|
||||
(constructor)
|
||||
(variable)
|
||||
(qualified_variable)
|
||||
]))
|
||||
(quasiquote)
|
||||
((exp_name)
|
||||
.
|
||||
(operator))
|
||||
]))
|
||||
]))
|
||||
|
||||
; Consider signatures (and accompanying functions)
|
||||
; with only one value on the rhs as variables
|
||||
|
@ -403,14 +398,13 @@
|
|||
; function defined in terms of a function composition
|
||||
(function
|
||||
name: (variable) @function
|
||||
rhs:
|
||||
(exp_infix
|
||||
(_)
|
||||
.
|
||||
(operator) @_op
|
||||
.
|
||||
(_)
|
||||
(#any-of? @_op "." ">>>" "***" ">=>" "<=<")))
|
||||
rhs: (exp_infix
|
||||
(_)
|
||||
.
|
||||
(operator) @_op
|
||||
.
|
||||
(_)
|
||||
(#any-of? @_op "." ">>>" "***" ">=>" "<=<")))
|
||||
|
||||
(exp_apply
|
||||
(exp_name
|
||||
|
@ -486,9 +480,8 @@
|
|||
|
||||
; scoped function types (func :: a -> b)
|
||||
(pat_typed
|
||||
pattern:
|
||||
(pat_name
|
||||
(variable) @function)
|
||||
pattern: (pat_name
|
||||
(variable) @function)
|
||||
type: (fun))
|
||||
|
||||
; signatures that have a function type
|
||||
|
@ -618,12 +611,11 @@
|
|||
(variable) @variable.member))
|
||||
|
||||
(exp_field
|
||||
field:
|
||||
[
|
||||
(variable) @variable.member
|
||||
(qualified_variable
|
||||
(variable) @variable.member)
|
||||
])
|
||||
field: [
|
||||
(variable) @variable.member
|
||||
(qualified_variable
|
||||
(variable) @variable.member)
|
||||
])
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; Spell checking
|
||||
|
|
|
@ -104,10 +104,9 @@
|
|||
;
|
||||
; highlight identifier keys as though they were block attributes
|
||||
(object_elem
|
||||
key:
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier) @variable.member)))
|
||||
key: (expression
|
||||
(variable_expr
|
||||
(identifier) @variable.member)))
|
||||
|
||||
; var.foo, data.bar
|
||||
;
|
||||
|
|
|
@ -31,11 +31,10 @@
|
|||
|
||||
; {{ .Values.test }}
|
||||
(selector_expression
|
||||
operand:
|
||||
(field
|
||||
name: (identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
"Values" "Chart" "Release" "Capabilities" "Files" "Subcharts" "Template"))
|
||||
operand: (field
|
||||
name: (identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
"Values" "Chart" "Release" "Capabilities" "Files" "Subcharts" "Template"))
|
||||
(field_identifier))
|
||||
|
||||
; {{ $.Values.test }}
|
||||
|
|
|
@ -7,10 +7,9 @@
|
|||
; {{ regexFind "[a-zA-Z][1-9]" "abcd1234" }}
|
||||
(function_call
|
||||
function: (identifier) @_function
|
||||
arguments:
|
||||
(argument_list
|
||||
.
|
||||
(interpreted_string_literal) @injection.content)
|
||||
arguments: (argument_list
|
||||
.
|
||||
(interpreted_string_literal) @injection.content)
|
||||
(#any-of? @_function
|
||||
"regexMatch" "mustRegexMatch" "regexFindAll" "mustRegexFinDall" "regexFind" "mustRegexFind"
|
||||
"regexReplaceAll" "mustRegexReplaceAll" "regexReplaceAllLiteral" "mustRegexReplaceAllLiteral"
|
||||
|
@ -20,20 +19,18 @@
|
|||
|
||||
(function_call
|
||||
function: (identifier) @_function
|
||||
arguments:
|
||||
(argument_list
|
||||
.
|
||||
(interpreted_string_literal) @injection.content)
|
||||
arguments: (argument_list
|
||||
.
|
||||
(interpreted_string_literal) @injection.content)
|
||||
(#any-of? @_function "fromYaml" "fromYamlArray")
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.language "yaml"))
|
||||
|
||||
(function_call
|
||||
function: (identifier) @_function
|
||||
arguments:
|
||||
(argument_list
|
||||
.
|
||||
(interpreted_string_literal) @injection.content)
|
||||
arguments: (argument_list
|
||||
.
|
||||
(interpreted_string_literal) @injection.content)
|
||||
(#any-of? @_function "fromJson" "fromJsonArray")
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.language "json"))
|
||||
|
|
|
@ -111,9 +111,8 @@
|
|||
|
||||
; Fields
|
||||
(field_declaration
|
||||
declarator:
|
||||
(variable_declarator
|
||||
name: (identifier) @variable.member))
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @variable.member))
|
||||
|
||||
(field_access
|
||||
field: (identifier) @variable.member)
|
||||
|
|
|
@ -10,19 +10,17 @@
|
|||
|
||||
((method_invocation
|
||||
name: (identifier) @_method
|
||||
arguments:
|
||||
(argument_list
|
||||
arguments: (argument_list
|
||||
.
|
||||
(string_literal
|
||||
.
|
||||
(string_literal
|
||||
.
|
||||
(_) @injection.content)))
|
||||
(_) @injection.content)))
|
||||
(#any-of? @_method "format" "printf")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
((method_invocation
|
||||
object:
|
||||
(string_literal
|
||||
(string_fragment) @injection.content)
|
||||
object: (string_literal
|
||||
(string_fragment) @injection.content)
|
||||
name: (identifier) @_method)
|
||||
(#eq? @_method "formatted")
|
||||
(#set! injection.language "printf"))
|
||||
|
|
|
@ -67,9 +67,8 @@
|
|||
name: (identifier) @local.definition.method)
|
||||
|
||||
(local_variable_declaration
|
||||
declarator:
|
||||
(variable_declarator
|
||||
name: (identifier) @local.definition.var))
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @local.definition.var))
|
||||
|
||||
(enhanced_for_statement
|
||||
; for (var item : items) {
|
||||
|
@ -92,9 +91,8 @@
|
|||
(#has-ancestor? @local.definition.import import_declaration))
|
||||
|
||||
(field_declaration
|
||||
declarator:
|
||||
(variable_declarator
|
||||
name: (identifier) @local.definition.field))
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @local.definition.field))
|
||||
|
||||
; REFERENCES
|
||||
(identifier) @local.reference
|
||||
|
|
|
@ -7,18 +7,16 @@
|
|||
; this.quuz = "qux";
|
||||
; }
|
||||
(field_definition
|
||||
property:
|
||||
[
|
||||
(property_identifier)
|
||||
(private_property_identifier)
|
||||
] @local.definition.var)
|
||||
property: [
|
||||
(property_identifier)
|
||||
(private_property_identifier)
|
||||
] @local.definition.var)
|
||||
|
||||
; this.foo = "bar"
|
||||
(assignment_expression
|
||||
left:
|
||||
(member_expression
|
||||
object: (this)
|
||||
property: (property_identifier) @local.definition.var))
|
||||
left: (member_expression
|
||||
object: (this)
|
||||
property: (property_identifier) @local.definition.var))
|
||||
|
||||
(formal_parameters
|
||||
(identifier) @local.definition.parameter)
|
||||
|
|
|
@ -104,15 +104,13 @@
|
|||
|
||||
; Functions
|
||||
(field
|
||||
function:
|
||||
(fieldname
|
||||
(id) @function))
|
||||
function: (fieldname
|
||||
(id) @function))
|
||||
|
||||
(field
|
||||
function:
|
||||
(fieldname
|
||||
(string
|
||||
(string_content) @function)))
|
||||
function: (fieldname
|
||||
(string
|
||||
(string_content) @function)))
|
||||
|
||||
(param
|
||||
identifier: (id) @variable.parameter)
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
(local_bind) @local.scope
|
||||
|
||||
(field
|
||||
function:
|
||||
(fieldname
|
||||
(id) @local.definition.function)
|
||||
function: (fieldname
|
||||
(id) @local.definition.function)
|
||||
(#set! "definition.function.scope" "parent"))
|
||||
|
||||
(bind
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
(jsx_element
|
||||
open_tag:
|
||||
(jsx_opening_element
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
] @tag.delimiter))
|
||||
open_tag: (jsx_opening_element
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
] @tag.delimiter))
|
||||
|
||||
(jsx_element
|
||||
close_tag:
|
||||
(jsx_closing_element
|
||||
[
|
||||
"</"
|
||||
">"
|
||||
] @tag.delimiter))
|
||||
close_tag: (jsx_closing_element
|
||||
[
|
||||
"</"
|
||||
">"
|
||||
] @tag.delimiter))
|
||||
|
||||
(jsx_self_closing_element
|
||||
[
|
||||
|
|
|
@ -31,14 +31,12 @@
|
|||
name: (identifier) @function)
|
||||
|
||||
(function_definition
|
||||
name:
|
||||
(field_expression
|
||||
(identifier) @function .))
|
||||
name: (field_expression
|
||||
(identifier) @function .))
|
||||
|
||||
(short_function_definition
|
||||
name:
|
||||
(field_expression
|
||||
(identifier) @function .))
|
||||
name: (field_expression
|
||||
(identifier) @function .))
|
||||
|
||||
; calls
|
||||
(call_expression
|
||||
|
|
|
@ -42,22 +42,19 @@
|
|||
; General environments
|
||||
(begin
|
||||
command: _ @module
|
||||
name:
|
||||
(curly_group_text
|
||||
(text) @label))
|
||||
name: (curly_group_text
|
||||
(text) @label))
|
||||
|
||||
(end
|
||||
command: _ @module
|
||||
name:
|
||||
(curly_group_text
|
||||
(text) @label))
|
||||
name: (curly_group_text
|
||||
(text) @label))
|
||||
|
||||
; Definitions and references
|
||||
(new_command_definition
|
||||
command: _ @function.macro
|
||||
declaration:
|
||||
(curly_group_command_name
|
||||
(_) @function))
|
||||
declaration: (curly_group_command_name
|
||||
(_) @function))
|
||||
|
||||
(old_command_definition
|
||||
command: _ @function.macro
|
||||
|
@ -69,48 +66,40 @@
|
|||
|
||||
(environment_definition
|
||||
command: _ @function.macro
|
||||
name:
|
||||
(curly_group_text
|
||||
(_) @markup.link))
|
||||
name: (curly_group_text
|
||||
(_) @markup.link))
|
||||
|
||||
(theorem_definition
|
||||
command: _ @function.macro
|
||||
name:
|
||||
(curly_group_text
|
||||
(_) @label))
|
||||
name: (curly_group_text
|
||||
(_) @label))
|
||||
|
||||
(paired_delimiter_definition
|
||||
command: _ @function.macro
|
||||
declaration:
|
||||
(curly_group_command_name
|
||||
(_) @function))
|
||||
declaration: (curly_group_command_name
|
||||
(_) @function))
|
||||
|
||||
(label_definition
|
||||
command: _ @function.macro
|
||||
name:
|
||||
(curly_group_text
|
||||
(_) @markup.link))
|
||||
name: (curly_group_text
|
||||
(_) @markup.link))
|
||||
|
||||
(label_reference_range
|
||||
command: _ @function.macro
|
||||
from:
|
||||
(curly_group_text
|
||||
(_) @markup.link)
|
||||
to:
|
||||
(curly_group_text
|
||||
(_) @markup.link))
|
||||
from: (curly_group_text
|
||||
(_) @markup.link)
|
||||
to: (curly_group_text
|
||||
(_) @markup.link))
|
||||
|
||||
(label_reference
|
||||
command: _ @function.macro
|
||||
names:
|
||||
(curly_group_text_list
|
||||
(_) @markup.link))
|
||||
names: (curly_group_text_list
|
||||
(_) @markup.link))
|
||||
|
||||
(label_number
|
||||
command: _ @function.macro
|
||||
name:
|
||||
(curly_group_text
|
||||
(_) @markup.link)
|
||||
name: (curly_group_text
|
||||
(_) @markup.link)
|
||||
number: (_) @markup.link)
|
||||
|
||||
(citation
|
||||
|
@ -119,52 +108,44 @@
|
|||
|
||||
(glossary_entry_definition
|
||||
command: _ @function.macro
|
||||
name:
|
||||
(curly_group_text
|
||||
(_) @markup.link))
|
||||
name: (curly_group_text
|
||||
(_) @markup.link))
|
||||
|
||||
(glossary_entry_reference
|
||||
command: _ @function.macro
|
||||
name:
|
||||
(curly_group_text
|
||||
(_) @markup.link))
|
||||
name: (curly_group_text
|
||||
(_) @markup.link))
|
||||
|
||||
(acronym_definition
|
||||
command: _ @function.macro
|
||||
name:
|
||||
(curly_group_text
|
||||
(_) @markup.link))
|
||||
name: (curly_group_text
|
||||
(_) @markup.link))
|
||||
|
||||
(acronym_reference
|
||||
command: _ @function.macro
|
||||
name:
|
||||
(curly_group_text
|
||||
(_) @markup.link))
|
||||
name: (curly_group_text
|
||||
(_) @markup.link))
|
||||
|
||||
(color_definition
|
||||
command: _ @function.macro
|
||||
name:
|
||||
(curly_group_text
|
||||
(_) @markup.link))
|
||||
name: (curly_group_text
|
||||
(_) @markup.link))
|
||||
|
||||
(color_reference
|
||||
command: _ @function.macro
|
||||
name:
|
||||
(curly_group_text
|
||||
(_) @markup.link))
|
||||
name: (curly_group_text
|
||||
(_) @markup.link))
|
||||
|
||||
; Formatting
|
||||
(text_mode
|
||||
content:
|
||||
(curly_group
|
||||
(_) @none @spell))
|
||||
content: (curly_group
|
||||
(_) @none @spell))
|
||||
|
||||
(math_environment
|
||||
(begin
|
||||
command: _ @markup.math
|
||||
name:
|
||||
(curly_group_text
|
||||
(_) @markup.math)))
|
||||
name: (curly_group_text
|
||||
(_) @markup.math)))
|
||||
|
||||
(math_environment
|
||||
(_) @markup.math)
|
||||
|
@ -172,95 +153,76 @@
|
|||
(math_environment
|
||||
(end
|
||||
command: _ @markup.math
|
||||
name:
|
||||
(curly_group_text
|
||||
(_) @markup.math)))
|
||||
name: (curly_group_text
|
||||
(_) @markup.math)))
|
||||
|
||||
; Sectioning
|
||||
(title_declaration
|
||||
command: _ @module
|
||||
options:
|
||||
(brack_group
|
||||
(_) @markup.heading.1)?
|
||||
text:
|
||||
(curly_group
|
||||
(_) @markup.heading.1))
|
||||
options: (brack_group
|
||||
(_) @markup.heading.1)?
|
||||
text: (curly_group
|
||||
(_) @markup.heading.1))
|
||||
|
||||
(author_declaration
|
||||
command: _ @module
|
||||
authors:
|
||||
(curly_group_author_list
|
||||
(author)+ @markup.heading.1))
|
||||
authors: (curly_group_author_list
|
||||
(author)+ @markup.heading.1))
|
||||
|
||||
(chapter
|
||||
command: _ @module
|
||||
toc:
|
||||
(brack_group
|
||||
(_) @markup.heading.2)?
|
||||
text:
|
||||
(curly_group
|
||||
(_) @markup.heading.2))
|
||||
toc: (brack_group
|
||||
(_) @markup.heading.2)?
|
||||
text: (curly_group
|
||||
(_) @markup.heading.2))
|
||||
|
||||
(part
|
||||
command: _ @module
|
||||
toc:
|
||||
(brack_group
|
||||
(_) @markup.heading.2)?
|
||||
text:
|
||||
(curly_group
|
||||
(_) @markup.heading.2))
|
||||
toc: (brack_group
|
||||
(_) @markup.heading.2)?
|
||||
text: (curly_group
|
||||
(_) @markup.heading.2))
|
||||
|
||||
(section
|
||||
command: _ @module
|
||||
toc:
|
||||
(brack_group
|
||||
(_) @markup.heading.3)?
|
||||
text:
|
||||
(curly_group
|
||||
(_) @markup.heading.3))
|
||||
toc: (brack_group
|
||||
(_) @markup.heading.3)?
|
||||
text: (curly_group
|
||||
(_) @markup.heading.3))
|
||||
|
||||
(subsection
|
||||
command: _ @module
|
||||
toc:
|
||||
(brack_group
|
||||
(_) @markup.heading.4)?
|
||||
text:
|
||||
(curly_group
|
||||
(_) @markup.heading.4))
|
||||
toc: (brack_group
|
||||
(_) @markup.heading.4)?
|
||||
text: (curly_group
|
||||
(_) @markup.heading.4))
|
||||
|
||||
(subsubsection
|
||||
command: _ @module
|
||||
toc:
|
||||
(brack_group
|
||||
(_) @markup.heading.5)?
|
||||
text:
|
||||
(curly_group
|
||||
(_) @markup.heading.5))
|
||||
toc: (brack_group
|
||||
(_) @markup.heading.5)?
|
||||
text: (curly_group
|
||||
(_) @markup.heading.5))
|
||||
|
||||
(paragraph
|
||||
command: _ @module
|
||||
toc:
|
||||
(brack_group
|
||||
(_) @markup.heading.6)?
|
||||
text:
|
||||
(curly_group
|
||||
(_) @markup.heading.6))
|
||||
toc: (brack_group
|
||||
(_) @markup.heading.6)?
|
||||
text: (curly_group
|
||||
(_) @markup.heading.6))
|
||||
|
||||
(subparagraph
|
||||
command: _ @module
|
||||
toc:
|
||||
(brack_group
|
||||
(_) @markup.heading.6)?
|
||||
text:
|
||||
(curly_group
|
||||
(_) @markup.heading.6))
|
||||
toc: (brack_group
|
||||
(_) @markup.heading.6)?
|
||||
text: (curly_group
|
||||
(_) @markup.heading.6))
|
||||
|
||||
; Beamer frames
|
||||
(generic_environment
|
||||
(begin
|
||||
name:
|
||||
(curly_group_text
|
||||
(text) @label)
|
||||
name: (curly_group_text
|
||||
(text) @label)
|
||||
(#any-of? @label "frame"))
|
||||
.
|
||||
(curly_group
|
||||
|
@ -268,38 +230,33 @@
|
|||
|
||||
((generic_command
|
||||
command: (command_name) @_name
|
||||
arg:
|
||||
(curly_group
|
||||
(text) @markup.heading))
|
||||
arg: (curly_group
|
||||
(text) @markup.heading))
|
||||
(#eq? @_name "\\frametitle"))
|
||||
|
||||
((generic_command
|
||||
command: (command_name) @_name
|
||||
arg:
|
||||
(curly_group
|
||||
(_) @markup.italic))
|
||||
arg: (curly_group
|
||||
(_) @markup.italic))
|
||||
(#eq? @_name "\\emph"))
|
||||
|
||||
((generic_command
|
||||
command: (command_name) @_name
|
||||
arg:
|
||||
(curly_group
|
||||
(_) @markup.italic))
|
||||
arg: (curly_group
|
||||
(_) @markup.italic))
|
||||
(#any-of? @_name "\\textit" "\\mathit"))
|
||||
|
||||
((generic_command
|
||||
command: (command_name) @_name
|
||||
arg:
|
||||
(curly_group
|
||||
(_) @markup.strong))
|
||||
arg: (curly_group
|
||||
(_) @markup.strong))
|
||||
(#any-of? @_name "\\textbf" "\\mathbf"))
|
||||
|
||||
((generic_command
|
||||
command: (command_name) @_name
|
||||
.
|
||||
arg:
|
||||
(curly_group
|
||||
(_) @markup.link.url))
|
||||
arg: (curly_group
|
||||
(_) @markup.link.url))
|
||||
(#any-of? @_name "\\url" "\\href"))
|
||||
|
||||
; File inclusion commands
|
||||
|
|
|
@ -19,15 +19,13 @@
|
|||
|
||||
(minted_environment
|
||||
(begin
|
||||
language:
|
||||
(curly_group_text
|
||||
(text) @injection.language))
|
||||
language: (curly_group_text
|
||||
(text) @injection.language))
|
||||
(source_code) @injection.content)
|
||||
|
||||
((generic_environment
|
||||
(begin
|
||||
name:
|
||||
(curly_group_text
|
||||
(text) @_env))) @injection.content
|
||||
name: (curly_group_text
|
||||
(text) @_env))) @injection.content
|
||||
(#set! injection.language "c")
|
||||
(#any-of? @_env "asy" "asydef"))
|
||||
|
|
|
@ -180,27 +180,24 @@
|
|||
(vararg_expression) @variable.parameter.builtin
|
||||
|
||||
(function_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @function
|
||||
(dot_index_expression
|
||||
field: (identifier) @function)
|
||||
])
|
||||
name: [
|
||||
(identifier) @function
|
||||
(dot_index_expression
|
||||
field: (identifier) @function)
|
||||
])
|
||||
|
||||
(function_declaration
|
||||
name:
|
||||
(method_index_expression
|
||||
method: (identifier) @function.method))
|
||||
name: (method_index_expression
|
||||
method: (identifier) @function.method))
|
||||
|
||||
(assignment_statement
|
||||
(variable_list
|
||||
.
|
||||
name:
|
||||
[
|
||||
(identifier) @function
|
||||
(dot_index_expression
|
||||
field: (identifier) @function)
|
||||
])
|
||||
name: [
|
||||
(identifier) @function
|
||||
(dot_index_expression
|
||||
field: (identifier) @function)
|
||||
])
|
||||
(expression_list
|
||||
.
|
||||
value: (function_definition)))
|
||||
|
@ -211,14 +208,13 @@
|
|||
value: (function_definition)))
|
||||
|
||||
(function_call
|
||||
name:
|
||||
[
|
||||
(identifier) @function.call
|
||||
(dot_index_expression
|
||||
field: (identifier) @function.call)
|
||||
(method_index_expression
|
||||
method: (identifier) @function.method.call)
|
||||
])
|
||||
name: [
|
||||
(identifier) @function.call
|
||||
(dot_index_expression
|
||||
field: (identifier) @function.call)
|
||||
(method_index_expression
|
||||
method: (identifier) @function.method.call)
|
||||
])
|
||||
|
||||
(function_call
|
||||
(identifier) @function.builtin
|
||||
|
@ -253,21 +249,19 @@
|
|||
(dot_index_expression
|
||||
field: (identifier) @_method
|
||||
(#any-of? @_method "find" "match" "gmatch" "gsub"))
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: (string_content) @string.regexp)))
|
||||
arguments: (arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: (string_content) @string.regexp)))
|
||||
|
||||
;("123"):match("%d+")
|
||||
(function_call
|
||||
(method_index_expression
|
||||
method: (identifier) @_method
|
||||
(#any-of? @_method "find" "match" "gmatch" "gsub"))
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(string
|
||||
content: (string_content) @string.regexp)))
|
||||
arguments: (arguments
|
||||
.
|
||||
(string
|
||||
content: (string_content) @string.regexp)))
|
||||
|
|
|
@ -1,49 +1,44 @@
|
|||
((function_call
|
||||
name:
|
||||
[
|
||||
(identifier) @_cdef_identifier
|
||||
(_
|
||||
_
|
||||
(identifier) @_cdef_identifier)
|
||||
]
|
||||
arguments:
|
||||
(arguments
|
||||
(string
|
||||
content: _ @injection.content)))
|
||||
name: [
|
||||
(identifier) @_cdef_identifier
|
||||
(_
|
||||
_
|
||||
(identifier) @_cdef_identifier)
|
||||
]
|
||||
arguments: (arguments
|
||||
(string
|
||||
content: _ @injection.content)))
|
||||
(#set! injection.language "c")
|
||||
(#eq? @_cdef_identifier "cdef"))
|
||||
|
||||
((function_call
|
||||
name: (_) @_vimcmd_identifier
|
||||
arguments:
|
||||
(arguments
|
||||
(string
|
||||
content: _ @injection.content)))
|
||||
arguments: (arguments
|
||||
(string
|
||||
content: _ @injection.content)))
|
||||
(#set! injection.language "vim")
|
||||
(#any-of? @_vimcmd_identifier
|
||||
"vim.cmd" "vim.api.nvim_command" "vim.api.nvim_command" "vim.api.nvim_exec2"))
|
||||
|
||||
((function_call
|
||||
name: (_) @_vimcmd_identifier
|
||||
arguments:
|
||||
(arguments
|
||||
(string
|
||||
content: _ @injection.content) .))
|
||||
arguments: (arguments
|
||||
(string
|
||||
content: _ @injection.content) .))
|
||||
(#set! injection.language "query")
|
||||
(#any-of? @_vimcmd_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse"))
|
||||
|
||||
((function_call
|
||||
name: (_) @_vimcmd_identifier
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: _ @_method)
|
||||
.
|
||||
(string
|
||||
content: _ @injection.content)))
|
||||
arguments: (arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: _ @_method)
|
||||
.
|
||||
(string
|
||||
content: _ @injection.content)))
|
||||
(#any-of? @_vimcmd_identifier "vim.rpcrequest" "vim.rpcnotify")
|
||||
(#eq? @_method "nvim_exec_lua")
|
||||
(#set! injection.language "lua"))
|
||||
|
@ -51,17 +46,15 @@
|
|||
; vim.api.nvim_create_autocmd("FileType", { command = "injected here" })
|
||||
(function_call
|
||||
name: (_) @_vimcmd_identifier
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(table_constructor
|
||||
(field
|
||||
name: (identifier) @_command
|
||||
value:
|
||||
(string
|
||||
content: (_) @injection.content))) .)
|
||||
arguments: (arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(table_constructor
|
||||
(field
|
||||
name: (identifier) @_command
|
||||
value: (string
|
||||
content: (_) @injection.content))) .)
|
||||
; limit so only 2-argument functions gets matched before pred handle
|
||||
(#eq? @_vimcmd_identifier "vim.api.nvim_create_autocmd")
|
||||
(#eq? @_command "command")
|
||||
|
@ -69,31 +62,29 @@
|
|||
|
||||
(function_call
|
||||
name: (_) @_user_cmd
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: (_) @injection.content)
|
||||
.
|
||||
(_) .)
|
||||
arguments: (arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: (_) @injection.content)
|
||||
.
|
||||
(_) .)
|
||||
(#eq? @_user_cmd "vim.api.nvim_create_user_command")
|
||||
(#set! injection.language "vim"))
|
||||
|
||||
(function_call
|
||||
name: (_) @_user_cmd
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: (_) @injection.content)
|
||||
.
|
||||
(_) .)
|
||||
arguments: (arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: (_) @injection.content)
|
||||
.
|
||||
(_) .)
|
||||
; Limiting predicate handling to only functions with 4 arguments
|
||||
(#eq? @_user_cmd "vim.api.nvim_buf_create_user_command")
|
||||
(#set! injection.language "vim"))
|
||||
|
@ -141,48 +132,44 @@
|
|||
(dot_index_expression
|
||||
field: (identifier) @_method
|
||||
(#any-of? @_method "find" "match" "gmatch" "gsub"))
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: (string_content) @injection.content
|
||||
(#set! injection.language "luap")
|
||||
(#set! injection.include-children))))
|
||||
arguments: (arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: (string_content) @injection.content
|
||||
(#set! injection.language "luap")
|
||||
(#set! injection.include-children))))
|
||||
|
||||
;("123"):match("%d+")
|
||||
(function_call
|
||||
(method_index_expression
|
||||
method: (identifier) @_method
|
||||
(#any-of? @_method "find" "match" "gmatch" "gsub"))
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(string
|
||||
content: (string_content) @injection.content
|
||||
(#set! injection.language "luap")
|
||||
(#set! injection.include-children))))
|
||||
arguments: (arguments
|
||||
.
|
||||
(string
|
||||
content: (string_content) @injection.content
|
||||
(#set! injection.language "luap")
|
||||
(#set! injection.include-children))))
|
||||
|
||||
; string.format("pi = %.2f", 3.14159)
|
||||
((function_call
|
||||
(dot_index_expression
|
||||
field: (identifier) @_method)
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(string
|
||||
(string_content) @injection.content)))
|
||||
arguments: (arguments
|
||||
.
|
||||
(string
|
||||
(string_content) @injection.content)))
|
||||
(#eq? @_method "format")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
; ("pi = %.2f"):format(3.14159)
|
||||
((function_call
|
||||
(method_index_expression
|
||||
table:
|
||||
(_
|
||||
(string
|
||||
(string_content) @injection.content))
|
||||
table: (_
|
||||
(string
|
||||
(string_content) @injection.content))
|
||||
method: (identifier) @_method))
|
||||
(#eq? @_method "format")
|
||||
(#set! injection.language "printf"))
|
||||
|
|
|
@ -27,19 +27,17 @@
|
|||
(#set! definition.function.scope "parent"))
|
||||
|
||||
((function_declaration
|
||||
name:
|
||||
(dot_index_expression
|
||||
.
|
||||
(_) @local.definition.associated
|
||||
(identifier) @local.definition.function))
|
||||
name: (dot_index_expression
|
||||
.
|
||||
(_) @local.definition.associated
|
||||
(identifier) @local.definition.function))
|
||||
(#set! definition.method.scope "parent"))
|
||||
|
||||
((function_declaration
|
||||
name:
|
||||
(method_index_expression
|
||||
.
|
||||
(_) @local.definition.associated
|
||||
(identifier) @local.definition.method))
|
||||
name: (method_index_expression
|
||||
.
|
||||
(_) @local.definition.associated
|
||||
(identifier) @local.definition.method))
|
||||
(#set! definition.method.scope "parent"))
|
||||
|
||||
(for_generic_clause
|
||||
|
|
|
@ -199,14 +199,12 @@
|
|||
name: (identifier) @function)
|
||||
|
||||
(function_call
|
||||
name:
|
||||
(dot_index_expression
|
||||
field: (identifier) @function.call))
|
||||
name: (dot_index_expression
|
||||
field: (identifier) @function.call))
|
||||
|
||||
(function_declaration
|
||||
name:
|
||||
(dot_index_expression
|
||||
field: (identifier) @function))
|
||||
name: (dot_index_expression
|
||||
field: (identifier) @function))
|
||||
|
||||
(method_index_expression
|
||||
method: (identifier) @function.method.call)
|
||||
|
@ -256,13 +254,12 @@
|
|||
] @punctuation.bracket
|
||||
|
||||
(variable_list
|
||||
attribute:
|
||||
(attribute
|
||||
([
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket
|
||||
(identifier) @attribute)))
|
||||
attribute: (attribute
|
||||
([
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket
|
||||
(identifier) @attribute)))
|
||||
|
||||
(generic_type
|
||||
[
|
||||
|
@ -290,21 +287,19 @@
|
|||
(dot_index_expression
|
||||
field: (identifier) @_method
|
||||
(#any-of? @_method "find" "format" "match" "gmatch" "gsub"))
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: _ @string.regexp)))
|
||||
arguments: (arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: _ @string.regexp)))
|
||||
|
||||
; ("123"):match("%d+")
|
||||
(function_call
|
||||
(method_index_expression
|
||||
method: (identifier) @_method
|
||||
(#any-of? @_method "find" "format" "match" "gmatch" "gsub"))
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(string
|
||||
content: _ @string.regexp)))
|
||||
arguments: (arguments
|
||||
.
|
||||
(string
|
||||
content: _ @string.regexp)))
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
((function_call
|
||||
name:
|
||||
[
|
||||
(identifier) @_cdef_identifier
|
||||
(_
|
||||
_
|
||||
(identifier) @_cdef_identifier)
|
||||
]
|
||||
arguments:
|
||||
(arguments
|
||||
(string
|
||||
content: _ @injection.content)))
|
||||
name: [
|
||||
(identifier) @_cdef_identifier
|
||||
(_
|
||||
_
|
||||
(identifier) @_cdef_identifier)
|
||||
]
|
||||
arguments: (arguments
|
||||
(string
|
||||
content: _ @injection.content)))
|
||||
(#eq? @_cdef_identifier "cdef")
|
||||
(#set! injection.language "c"))
|
||||
|
||||
|
@ -23,13 +21,12 @@
|
|||
(dot_index_expression
|
||||
field: (identifier) @_method
|
||||
(#any-of? @_method "find" "format" "match" "gmatch" "gsub"))
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: _ @injection.content))
|
||||
arguments: (arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: _ @injection.content))
|
||||
(#set! injection.language "luap"))
|
||||
|
||||
; ("123"):match("%d+")
|
||||
|
@ -37,11 +34,10 @@
|
|||
(method_index_expression
|
||||
method: (identifier) @_method
|
||||
(#any-of? @_method "find" "format" "match" "gmatch" "gsub"))
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(string
|
||||
content: _ @injection.content))
|
||||
arguments: (arguments
|
||||
.
|
||||
(string
|
||||
content: _ @injection.content))
|
||||
(#set! injection.language "luap"))
|
||||
|
||||
((comment) @injection.content
|
||||
|
|
|
@ -30,19 +30,17 @@
|
|||
(#set! definition.function.scope "parent"))
|
||||
|
||||
((function_declaration
|
||||
name:
|
||||
(dot_index_expression
|
||||
.
|
||||
(_) @local.definition.associated
|
||||
(identifier) @local.definition.function))
|
||||
name: (dot_index_expression
|
||||
.
|
||||
(_) @local.definition.associated
|
||||
(identifier) @local.definition.function))
|
||||
(#set! definition.method.scope "parent"))
|
||||
|
||||
((function_declaration
|
||||
name:
|
||||
(method_index_expression
|
||||
.
|
||||
(_) @local.definition.associated
|
||||
(identifier) @local.definition.method))
|
||||
name: (method_index_expression
|
||||
.
|
||||
(_) @local.definition.associated
|
||||
(identifier) @local.definition.method))
|
||||
(#set! definition.method.scope "parent"))
|
||||
|
||||
(for_generic_clause
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
name: (symbol) @local.definition.constant)
|
||||
|
||||
(external_reference
|
||||
symbols:
|
||||
(symbol_list
|
||||
(symbol) @local.definition.import))
|
||||
symbols: (symbol_list
|
||||
(symbol) @local.definition.import))
|
||||
|
||||
(symbol) @local.reference
|
||||
|
|
|
@ -48,9 +48,8 @@
|
|||
"include"
|
||||
"-include"
|
||||
] @keyword.import
|
||||
filenames:
|
||||
(list
|
||||
(word) @string.special.path))
|
||||
filenames: (list
|
||||
(word) @string.special.path))
|
||||
|
||||
(variable_assignment
|
||||
name: (word) @string.special.symbol
|
||||
|
|
|
@ -66,11 +66,9 @@
|
|||
(builtin) @function.builtin
|
||||
|
||||
(fun_expr
|
||||
pats:
|
||||
(pattern_fun
|
||||
(ident) @variable.parameter))
|
||||
pats: (pattern_fun
|
||||
(ident) @variable.parameter))
|
||||
|
||||
(applicative
|
||||
t1:
|
||||
(applicative
|
||||
(record_operand) @function))
|
||||
t1: (applicative
|
||||
(record_operand) @function))
|
||||
|
|
|
@ -35,20 +35,16 @@
|
|||
; NOTE: has to be before literals and punctuation etc.
|
||||
; identifiers in "case" "of" branches have to be enums
|
||||
(case
|
||||
alternative:
|
||||
(of_branch
|
||||
values:
|
||||
(expression_list
|
||||
(_) @constant)))
|
||||
alternative: (of_branch
|
||||
values: (expression_list
|
||||
(_) @constant)))
|
||||
|
||||
; NOTE: has to be before literals and punctuation etc.
|
||||
; in variant objects with "case" "of"
|
||||
(variant_declaration
|
||||
alternative:
|
||||
(of_branch
|
||||
values:
|
||||
(expression_list
|
||||
(_) @constant)))
|
||||
alternative: (of_branch
|
||||
values: (expression_list
|
||||
(_) @constant)))
|
||||
|
||||
; NOTE: has to be before literals and punctuation etc.
|
||||
; =============================================================================
|
||||
|
@ -154,9 +150,8 @@
|
|||
(colon_expression
|
||||
left: (identifier) @_emit_keyword
|
||||
(#eq? @_emit_keyword "emit")
|
||||
right:
|
||||
(_
|
||||
(string_content) @none))))
|
||||
right: (_
|
||||
(string_content) @none))))
|
||||
|
||||
; =============================================================================
|
||||
; @string.escape ; escape sequences
|
||||
|
@ -184,240 +179,215 @@
|
|||
; =============================================================================
|
||||
; @function ; function definitions
|
||||
(proc_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @function
|
||||
name: [
|
||||
(identifier) @function
|
||||
(accent_quoted
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @function))
|
||||
])
|
||||
(identifier) @function))
|
||||
])
|
||||
|
||||
(func_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @function
|
||||
name: [
|
||||
(identifier) @function
|
||||
(accent_quoted
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @function))
|
||||
])
|
||||
(identifier) @function))
|
||||
])
|
||||
|
||||
(iterator_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @function
|
||||
name: [
|
||||
(identifier) @function
|
||||
(accent_quoted
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @function))
|
||||
])
|
||||
(identifier) @function))
|
||||
])
|
||||
|
||||
(converter_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @function
|
||||
name: [
|
||||
(identifier) @function
|
||||
(accent_quoted
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(identifier) @function)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @function))
|
||||
])
|
||||
(identifier) @function))
|
||||
])
|
||||
|
||||
; =============================================================================
|
||||
; @function.call ; function calls
|
||||
(call
|
||||
function:
|
||||
[
|
||||
(identifier) @function.call
|
||||
(accent_quoted
|
||||
(identifier) @function.call)
|
||||
; generic types
|
||||
(bracket_expression
|
||||
left: (identifier) @function.call)
|
||||
(bracket_expression
|
||||
left:
|
||||
(accent_quoted
|
||||
(identifier) @function.call))
|
||||
; dot accessor
|
||||
(dot_expression
|
||||
right: (identifier) @function.call)
|
||||
(dot_expression
|
||||
right:
|
||||
(accent_quoted
|
||||
(identifier) @function.call))
|
||||
; both
|
||||
(bracket_expression
|
||||
left:
|
||||
(dot_expression
|
||||
right: (identifier) @function.call))
|
||||
(bracket_expression
|
||||
left:
|
||||
(dot_expression
|
||||
right:
|
||||
(accent_quoted
|
||||
(identifier) @function.call)))
|
||||
])
|
||||
function: [
|
||||
(identifier) @function.call
|
||||
(accent_quoted
|
||||
(identifier) @function.call)
|
||||
; generic types
|
||||
(bracket_expression
|
||||
left: (identifier) @function.call)
|
||||
(bracket_expression
|
||||
left: (accent_quoted
|
||||
(identifier) @function.call))
|
||||
; dot accessor
|
||||
(dot_expression
|
||||
right: (identifier) @function.call)
|
||||
(dot_expression
|
||||
right: (accent_quoted
|
||||
(identifier) @function.call))
|
||||
; both
|
||||
(bracket_expression
|
||||
left: (dot_expression
|
||||
right: (identifier) @function.call))
|
||||
(bracket_expression
|
||||
left: (dot_expression
|
||||
right: (accent_quoted
|
||||
(identifier) @function.call)))
|
||||
])
|
||||
|
||||
(dot_generic_call
|
||||
function:
|
||||
[
|
||||
(identifier) @function.call
|
||||
(accent_quoted
|
||||
(identifier) @function.call)
|
||||
])
|
||||
function: [
|
||||
(identifier) @function.call
|
||||
(accent_quoted
|
||||
(identifier) @function.call)
|
||||
])
|
||||
|
||||
; generalized_string is a function call
|
||||
; `identifier"string literal"`
|
||||
; is short for
|
||||
; `identifier(r"string literal")`
|
||||
(generalized_string
|
||||
function:
|
||||
[
|
||||
(identifier) @function.call
|
||||
(accent_quoted
|
||||
(identifier) @function.call)
|
||||
])
|
||||
function: [
|
||||
(identifier) @function.call
|
||||
(accent_quoted
|
||||
(identifier) @function.call)
|
||||
])
|
||||
|
||||
; call with leading literal
|
||||
(dot_expression
|
||||
left:
|
||||
[
|
||||
(nil_literal)
|
||||
(integer_literal)
|
||||
(float_literal)
|
||||
(custom_numeric_literal)
|
||||
(char_literal)
|
||||
(interpreted_string_literal)
|
||||
(long_string_literal)
|
||||
(raw_string_literal)
|
||||
(generalized_string)
|
||||
left: [
|
||||
(nil_literal)
|
||||
(integer_literal)
|
||||
(float_literal)
|
||||
(custom_numeric_literal)
|
||||
(char_literal)
|
||||
(interpreted_string_literal)
|
||||
(long_string_literal)
|
||||
(raw_string_literal)
|
||||
(generalized_string)
|
||||
(array_construction)
|
||||
; for sequences
|
||||
(prefix_expression
|
||||
operator: (operator) @_at
|
||||
(array_construction)
|
||||
; for sequences
|
||||
(prefix_expression
|
||||
operator: (operator) @_at
|
||||
(array_construction)
|
||||
(#eq? @_at "@"))
|
||||
(tuple_construction)
|
||||
(curly_construction)
|
||||
]
|
||||
right:
|
||||
[
|
||||
(identifier) @function.call
|
||||
(accent_quoted
|
||||
(identifier) @function.call)
|
||||
])
|
||||
(#eq? @_at "@"))
|
||||
(tuple_construction)
|
||||
(curly_construction)
|
||||
]
|
||||
right: [
|
||||
(identifier) @function.call
|
||||
(accent_quoted
|
||||
(identifier) @function.call)
|
||||
])
|
||||
|
||||
; NOTE: will double capture as @function.call if it also has argument_list
|
||||
; function.calls in `varargs[type, routine]`
|
||||
(bracket_expression
|
||||
left: (identifier) @_varargs
|
||||
right:
|
||||
(argument_list
|
||||
.
|
||||
(_)
|
||||
.
|
||||
[
|
||||
(identifier) @function.call
|
||||
(accent_quoted
|
||||
(identifier) @function.call)
|
||||
(dot_expression
|
||||
right: (identifier) @function.call)
|
||||
(dot_expression
|
||||
right:
|
||||
(accent_quoted
|
||||
(identifier) @function.call))
|
||||
])
|
||||
right: (argument_list
|
||||
.
|
||||
(_)
|
||||
.
|
||||
[
|
||||
(identifier) @function.call
|
||||
(accent_quoted
|
||||
(identifier) @function.call)
|
||||
(dot_expression
|
||||
right: (identifier) @function.call)
|
||||
(dot_expression
|
||||
right: (accent_quoted
|
||||
(identifier) @function.call))
|
||||
])
|
||||
(#eq? @_varargs "varargs"))
|
||||
|
||||
; =============================================================================
|
||||
; @function.macro ; preprocessor macros
|
||||
(template_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @function.macro
|
||||
name: [
|
||||
(identifier) @function.macro
|
||||
(accent_quoted
|
||||
(identifier) @function.macro)
|
||||
(exported_symbol
|
||||
(identifier) @function.macro)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @function.macro)
|
||||
(exported_symbol
|
||||
(identifier) @function.macro)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @function.macro))
|
||||
])
|
||||
(identifier) @function.macro))
|
||||
])
|
||||
|
||||
(macro_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @function.macro
|
||||
name: [
|
||||
(identifier) @function.macro
|
||||
(accent_quoted
|
||||
(identifier) @function.macro)
|
||||
(exported_symbol
|
||||
(identifier) @function.macro)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @function.macro)
|
||||
(exported_symbol
|
||||
(identifier) @function.macro)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @function.macro))
|
||||
])
|
||||
(identifier) @function.macro))
|
||||
])
|
||||
|
||||
; =============================================================================
|
||||
; @function.method ; method definitions
|
||||
(method_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @function.method
|
||||
name: [
|
||||
(identifier) @function.method
|
||||
(accent_quoted
|
||||
(identifier) @function.method)
|
||||
(exported_symbol
|
||||
(identifier) @function.method)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @function.method)
|
||||
(exported_symbol
|
||||
(identifier) @function.method)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @function.method))
|
||||
])
|
||||
(identifier) @function.method))
|
||||
])
|
||||
|
||||
; =============================================================================
|
||||
; @constructor ; constructor calls and definitions
|
||||
(call
|
||||
function:
|
||||
[
|
||||
(identifier) @constructor
|
||||
(accent_quoted
|
||||
(identifier) @constructor)
|
||||
; generic types
|
||||
(bracket_expression
|
||||
left: (identifier) @constructor)
|
||||
(bracket_expression
|
||||
left:
|
||||
(accent_quoted
|
||||
(identifier) @constructor))
|
||||
; dot accessor
|
||||
(dot_expression
|
||||
right: (identifier) @constructor)
|
||||
(dot_expression
|
||||
right:
|
||||
(accent_quoted
|
||||
(identifier) @constructor))
|
||||
; both
|
||||
(bracket_expression
|
||||
left:
|
||||
(dot_expression
|
||||
right: (identifier) @constructor))
|
||||
(bracket_expression
|
||||
left:
|
||||
(dot_expression
|
||||
right:
|
||||
(accent_quoted
|
||||
(identifier) @constructor)))
|
||||
]
|
||||
function: [
|
||||
(identifier) @constructor
|
||||
(accent_quoted
|
||||
(identifier) @constructor)
|
||||
; generic types
|
||||
(bracket_expression
|
||||
left: (identifier) @constructor)
|
||||
(bracket_expression
|
||||
left: (accent_quoted
|
||||
(identifier) @constructor))
|
||||
; dot accessor
|
||||
(dot_expression
|
||||
right: (identifier) @constructor)
|
||||
(dot_expression
|
||||
right: (accent_quoted
|
||||
(identifier) @constructor))
|
||||
; both
|
||||
(bracket_expression
|
||||
left: (dot_expression
|
||||
right: (identifier) @constructor))
|
||||
(bracket_expression
|
||||
left: (dot_expression
|
||||
right: (accent_quoted
|
||||
(identifier) @constructor)))
|
||||
]
|
||||
(argument_list
|
||||
(colon_expression)+))
|
||||
|
||||
|
@ -520,12 +490,11 @@
|
|||
; =============================================================================
|
||||
; @label ; GOTO and other labels (e.g. `label:` in C)
|
||||
(block
|
||||
label:
|
||||
[
|
||||
(identifier) @label
|
||||
(accent_quoted
|
||||
(identifier) @label)
|
||||
])
|
||||
label: [
|
||||
(identifier) @label
|
||||
(accent_quoted
|
||||
(identifier) @label)
|
||||
])
|
||||
|
||||
; =============================================================================
|
||||
; @keyword.import ; keywords for including modules (e.g. `import` / `from` in Python)
|
||||
|
@ -554,9 +523,8 @@
|
|||
; @type ; type or class definitions and annotations
|
||||
; generic types when calling
|
||||
(call
|
||||
function:
|
||||
(bracket_expression
|
||||
right: (argument_list) @type))
|
||||
function: (bracket_expression
|
||||
right: (argument_list) @type))
|
||||
|
||||
; NOTE: this also falsely matches
|
||||
; when accessing and directly call elements from an array of routines
|
||||
|
@ -567,11 +535,10 @@
|
|||
|
||||
; right side of `is` operator is always type
|
||||
(infix_expression
|
||||
operator:
|
||||
[
|
||||
"is"
|
||||
"isnot"
|
||||
]
|
||||
operator: [
|
||||
"is"
|
||||
"isnot"
|
||||
]
|
||||
right: (_) @type)
|
||||
|
||||
; except branch always contains types of errors
|
||||
|
@ -582,16 +549,14 @@
|
|||
; overrule special case in (except_branch) with "as" operator
|
||||
; `except module.exception[gen_type] as variable:`
|
||||
(except_branch
|
||||
values:
|
||||
(expression_list
|
||||
(infix_expression
|
||||
operator: "as"
|
||||
right:
|
||||
[
|
||||
(identifier) @variable
|
||||
(accent_quoted
|
||||
(identifier) @variable)
|
||||
])))
|
||||
values: (expression_list
|
||||
(infix_expression
|
||||
operator: "as"
|
||||
right: [
|
||||
(identifier) @variable
|
||||
(accent_quoted
|
||||
(identifier) @variable)
|
||||
])))
|
||||
|
||||
; for inline tuple types
|
||||
; `type a = tuple[a: int]`
|
||||
|
@ -608,24 +573,22 @@
|
|||
; call(parameter_name=arg)
|
||||
(argument_list
|
||||
(equal_expression
|
||||
left:
|
||||
[
|
||||
(identifier) @variable.parameter
|
||||
(accent_quoted
|
||||
(identifier) @variable.parameter)
|
||||
]))
|
||||
left: [
|
||||
(identifier) @variable.parameter
|
||||
(accent_quoted
|
||||
(identifier) @variable.parameter)
|
||||
]))
|
||||
|
||||
; parameters in function declaration
|
||||
(parameter_declaration_list
|
||||
(parameter_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @variable.parameter
|
||||
(accent_quoted
|
||||
(identifier) @variable.parameter)
|
||||
]))))
|
||||
name: [
|
||||
(identifier) @variable.parameter
|
||||
(accent_quoted
|
||||
(identifier) @variable.parameter)
|
||||
]))))
|
||||
|
||||
; NOTE: needs to be after @type
|
||||
; generic types when declaring
|
||||
|
@ -633,43 +596,38 @@
|
|||
(parameter_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @variable.parameter
|
||||
(accent_quoted
|
||||
(identifier) @variable.parameter)
|
||||
]))))
|
||||
name: [
|
||||
(identifier) @variable.parameter
|
||||
(accent_quoted
|
||||
(identifier) @variable.parameter)
|
||||
]))))
|
||||
|
||||
; for loop variables
|
||||
(for
|
||||
left:
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @variable.parameter
|
||||
(accent_quoted
|
||||
(identifier) @variable.parameter)
|
||||
])))
|
||||
left: (symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name: [
|
||||
(identifier) @variable.parameter
|
||||
(accent_quoted
|
||||
(identifier) @variable.parameter)
|
||||
])))
|
||||
|
||||
((tuple_deconstruct_declaration
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @variable.parameter
|
||||
(accent_quoted
|
||||
(identifier) @variable.parameter)
|
||||
])) @_tuple_decons
|
||||
name: [
|
||||
(identifier) @variable.parameter
|
||||
(accent_quoted
|
||||
(identifier) @variable.parameter)
|
||||
])) @_tuple_decons
|
||||
(#has-ancestor? @_tuple_decons for))
|
||||
|
||||
(concept_declaration
|
||||
parameters:
|
||||
(parameter_list
|
||||
[
|
||||
(identifier) @variable.parameter
|
||||
(accent_quoted
|
||||
(identifier) @variable.parameter)
|
||||
]))
|
||||
parameters: (parameter_list
|
||||
[
|
||||
(identifier) @variable.parameter
|
||||
(accent_quoted
|
||||
(identifier) @variable.parameter)
|
||||
]))
|
||||
|
||||
(var_parameter
|
||||
[
|
||||
|
@ -711,17 +669,16 @@
|
|||
(type_section
|
||||
(type_declaration
|
||||
(type_symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @type.definition
|
||||
name: [
|
||||
(identifier) @type.definition
|
||||
(accent_quoted
|
||||
(identifier) @type.definition)
|
||||
(exported_symbol
|
||||
(identifier) @type.definition)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @type.definition)
|
||||
(exported_symbol
|
||||
(identifier) @type.definition)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @type.definition))
|
||||
])))
|
||||
(identifier) @type.definition))
|
||||
])))
|
||||
|
||||
; =============================================================================
|
||||
; @keyword.modifier ; type qualifier keywords (e.g. `const`)
|
||||
|
@ -761,8 +718,41 @@
|
|||
(field_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
name: [
|
||||
(identifier) @variable.member
|
||||
(accent_quoted
|
||||
(identifier) @variable.member)
|
||||
(exported_symbol
|
||||
(identifier) @variable.member)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @variable.member))
|
||||
])))
|
||||
|
||||
; fields in object construction
|
||||
(call
|
||||
(argument_list
|
||||
(colon_expression
|
||||
left: [
|
||||
(identifier) @variable.member
|
||||
(accent_quoted
|
||||
(identifier) @variable.member)
|
||||
])))
|
||||
|
||||
; fields in tuple construction
|
||||
(tuple_construction
|
||||
(colon_expression
|
||||
left: [
|
||||
(identifier) @variable.member
|
||||
(accent_quoted
|
||||
(identifier) @variable.member)
|
||||
]))
|
||||
|
||||
(variant_declaration
|
||||
(variant_discriminator_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name: [
|
||||
(identifier) @variable.member
|
||||
(accent_quoted
|
||||
(identifier) @variable.member)
|
||||
|
@ -771,44 +761,7 @@
|
|||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @variable.member))
|
||||
])))
|
||||
|
||||
; fields in object construction
|
||||
(call
|
||||
(argument_list
|
||||
(colon_expression
|
||||
left:
|
||||
[
|
||||
(identifier) @variable.member
|
||||
(accent_quoted
|
||||
(identifier) @variable.member)
|
||||
])))
|
||||
|
||||
; fields in tuple construction
|
||||
(tuple_construction
|
||||
(colon_expression
|
||||
left:
|
||||
[
|
||||
(identifier) @variable.member
|
||||
(accent_quoted
|
||||
(identifier) @variable.member)
|
||||
]))
|
||||
|
||||
(variant_declaration
|
||||
(variant_discriminator_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @variable.member
|
||||
(accent_quoted
|
||||
(identifier) @variable.member)
|
||||
(exported_symbol
|
||||
(identifier) @variable.member)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @variable.member))
|
||||
]))))
|
||||
]))))
|
||||
|
||||
; =============================================================================
|
||||
; @variable.builtin ; built-in variable names (e.g. `this`)
|
||||
|
@ -824,84 +777,75 @@
|
|||
; enum declaration
|
||||
(enum_field_declaration
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @constant
|
||||
(accent_quoted
|
||||
(identifier) @constant)
|
||||
]))
|
||||
name: [
|
||||
(identifier) @constant
|
||||
(accent_quoted
|
||||
(identifier) @constant)
|
||||
]))
|
||||
|
||||
; constant declaration
|
||||
(const_section
|
||||
(variable_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @constant
|
||||
name: [
|
||||
(identifier) @constant
|
||||
(accent_quoted
|
||||
(identifier) @constant)
|
||||
(exported_symbol
|
||||
(identifier) @constant)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @constant)
|
||||
(exported_symbol
|
||||
(identifier) @constant)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @constant))
|
||||
]))))
|
||||
(identifier) @constant))
|
||||
]))))
|
||||
|
||||
((tuple_deconstruct_declaration
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @constant
|
||||
name: [
|
||||
(identifier) @constant
|
||||
(accent_quoted
|
||||
(identifier) @constant)
|
||||
(exported_symbol
|
||||
(identifier) @constant)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @constant)
|
||||
(exported_symbol
|
||||
(identifier) @constant)
|
||||
(exported_symbol
|
||||
(accent_quoted
|
||||
(identifier) @constant))
|
||||
])) @_tuple_decons
|
||||
(identifier) @constant))
|
||||
])) @_tuple_decons
|
||||
(#has-ancestor? @_tuple_decons const_section))
|
||||
|
||||
; constants x and y in `array[x..y, type]`
|
||||
(bracket_expression
|
||||
left: (identifier) @_array
|
||||
right:
|
||||
(argument_list
|
||||
.
|
||||
(infix_expression
|
||||
right:
|
||||
[
|
||||
(identifier) @constant
|
||||
(accent_quoted
|
||||
(identifier) @constant)
|
||||
(dot_expression
|
||||
right: (identifier) @constant)
|
||||
(dot_expression
|
||||
right:
|
||||
(accent_quoted
|
||||
(identifier) @constant))
|
||||
]))
|
||||
right: (argument_list
|
||||
.
|
||||
(infix_expression
|
||||
right: [
|
||||
(identifier) @constant
|
||||
(accent_quoted
|
||||
(identifier) @constant)
|
||||
(dot_expression
|
||||
right: (identifier) @constant)
|
||||
(dot_expression
|
||||
right: (accent_quoted
|
||||
(identifier) @constant))
|
||||
]))
|
||||
(#any-of? @_array "array" "range"))
|
||||
|
||||
(bracket_expression
|
||||
left: (identifier) @_array
|
||||
right:
|
||||
(argument_list
|
||||
.
|
||||
(infix_expression
|
||||
left:
|
||||
[
|
||||
(identifier) @constant
|
||||
(accent_quoted
|
||||
(identifier) @constant)
|
||||
(dot_expression
|
||||
right: (identifier) @constant)
|
||||
(dot_expression
|
||||
right:
|
||||
(accent_quoted
|
||||
(identifier) @constant))
|
||||
]))
|
||||
right: (argument_list
|
||||
.
|
||||
(infix_expression
|
||||
left: [
|
||||
(identifier) @constant
|
||||
(accent_quoted
|
||||
(identifier) @constant)
|
||||
(dot_expression
|
||||
right: (identifier) @constant)
|
||||
(dot_expression
|
||||
right: (accent_quoted
|
||||
(identifier) @constant))
|
||||
]))
|
||||
(#any-of? @_array "array" "range"))
|
||||
|
||||
; NOTE: can only do this for (infix_expression)s, since standalone identifiers
|
||||
|
@ -926,19 +870,17 @@
|
|||
(expression_list
|
||||
(infix_expression
|
||||
operator: (operator) @_operator
|
||||
right:
|
||||
[
|
||||
(identifier) @module
|
||||
(array_construction
|
||||
(identifier) @module)
|
||||
]))
|
||||
right: [
|
||||
(identifier) @module
|
||||
(array_construction
|
||||
(identifier) @module)
|
||||
]))
|
||||
(#eq? @_operator "/"))
|
||||
|
||||
(import_from_statement
|
||||
module:
|
||||
(infix_expression
|
||||
operator: (operator) @_operator
|
||||
right: (identifier) @module)
|
||||
module: (infix_expression
|
||||
operator: (operator) @_operator
|
||||
right: (identifier) @module)
|
||||
(#eq? @_operator "/"))
|
||||
|
||||
(export_statement
|
||||
|
@ -949,12 +891,11 @@
|
|||
; overrule things
|
||||
; left identifier in dot_expression
|
||||
(dot_expression
|
||||
left:
|
||||
[
|
||||
(identifier) @none
|
||||
(accent_quoted
|
||||
(identifier) @none)
|
||||
])
|
||||
left: [
|
||||
(identifier) @none
|
||||
(accent_quoted
|
||||
(identifier) @none)
|
||||
])
|
||||
|
||||
; NOTE: we can't know what the left identifier is, so better leave it alone
|
||||
; for consistency
|
||||
|
|
|
@ -52,9 +52,8 @@
|
|||
(colon_expression
|
||||
left: (identifier) @_emit_keyword
|
||||
(#eq? @_emit_keyword "emit")
|
||||
right:
|
||||
(_
|
||||
(string_content) @injection.content)))))
|
||||
right: (_
|
||||
(string_content) @injection.content)))))
|
||||
|
||||
; =============================================================================
|
||||
; asm statement
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
; ==============================================================================
|
||||
; @local.definition ; various definitions
|
||||
(block
|
||||
label:
|
||||
[
|
||||
(identifier) @local.definition
|
||||
(accent_quoted) @local.definition
|
||||
])
|
||||
label: [
|
||||
(identifier) @local.definition
|
||||
(accent_quoted) @local.definition
|
||||
])
|
||||
|
||||
; ==============================================================================
|
||||
; @local.definition.constant ; constants
|
||||
|
@ -13,79 +12,73 @@
|
|||
(variable_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.constant
|
||||
(accent_quoted) @local.definition.constant
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.constant)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.constant)
|
||||
]))
|
||||
name: [
|
||||
(identifier) @local.definition.constant
|
||||
(accent_quoted) @local.definition.constant
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.constant)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.constant)
|
||||
]))
|
||||
type: (type_expression)? @local.definition.associated))
|
||||
|
||||
; ==============================================================================
|
||||
; @local.definition.function ; functions
|
||||
(proc_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.function
|
||||
(accent_quoted) @local.definition.function
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.function)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.function)
|
||||
]
|
||||
name: [
|
||||
(identifier) @local.definition.function
|
||||
(accent_quoted) @local.definition.function
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.function)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.function)
|
||||
]
|
||||
(#set! "definition.function.scope" "parent"))
|
||||
|
||||
(func_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.function
|
||||
(accent_quoted) @local.definition.function
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.function)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.function)
|
||||
]
|
||||
name: [
|
||||
(identifier) @local.definition.function
|
||||
(accent_quoted) @local.definition.function
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.function)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.function)
|
||||
]
|
||||
(#set! "definition.function.scope" "parent"))
|
||||
|
||||
(iterator_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.function
|
||||
(accent_quoted) @local.definition.function
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.function)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.function)
|
||||
]
|
||||
name: [
|
||||
(identifier) @local.definition.function
|
||||
(accent_quoted) @local.definition.function
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.function)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.function)
|
||||
]
|
||||
(#set! "definition.function.scope" "parent"))
|
||||
|
||||
(converter_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.function
|
||||
(accent_quoted) @local.definition.function
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.function)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.function)
|
||||
]
|
||||
name: [
|
||||
(identifier) @local.definition.function
|
||||
(accent_quoted) @local.definition.function
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.function)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.function)
|
||||
]
|
||||
(#set! "definition.function.scope" "parent"))
|
||||
|
||||
; ==============================================================================
|
||||
; @local.definition.method ; methods
|
||||
(method_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.method
|
||||
(accent_quoted) @local.definition.method
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.method)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.method)
|
||||
]
|
||||
name: [
|
||||
(identifier) @local.definition.method
|
||||
(accent_quoted) @local.definition.method
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.method)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.method)
|
||||
]
|
||||
(#set! "definition.method.scope" "parent"))
|
||||
|
||||
; ==============================================================================
|
||||
|
@ -94,72 +87,65 @@
|
|||
(variable_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.var
|
||||
(accent_quoted) @local.definition.var
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.var)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.var)
|
||||
]))
|
||||
name: [
|
||||
(identifier) @local.definition.var
|
||||
(accent_quoted) @local.definition.var
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.var)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.var)
|
||||
]))
|
||||
type: (type_expression)? @local.definition.associated))
|
||||
|
||||
(let_section
|
||||
(variable_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.var
|
||||
(accent_quoted) @local.definition.var
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.var)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.var)
|
||||
]))
|
||||
name: [
|
||||
(identifier) @local.definition.var
|
||||
(accent_quoted) @local.definition.var
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.var)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.var)
|
||||
]))
|
||||
type: (type_expression)? @local.definition.associated))
|
||||
|
||||
(for
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.var
|
||||
(accent_quoted) @local.definition.var
|
||||
])))
|
||||
name: [
|
||||
(identifier) @local.definition.var
|
||||
(accent_quoted) @local.definition.var
|
||||
])))
|
||||
|
||||
(try
|
||||
(except_branch
|
||||
values:
|
||||
(expression_list
|
||||
(infix_expression
|
||||
right:
|
||||
[
|
||||
(identifier) @local.definition.var
|
||||
(accent_quoted) @local.definition.var
|
||||
]))))
|
||||
values: (expression_list
|
||||
(infix_expression
|
||||
right: [
|
||||
(identifier) @local.definition.var
|
||||
(accent_quoted) @local.definition.var
|
||||
]))))
|
||||
|
||||
; ==============================================================================
|
||||
; @local.definition.parameter ; parameters
|
||||
(parameter_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.parameter
|
||||
(accent_quoted) @local.definition.parameter
|
||||
]))
|
||||
name: [
|
||||
(identifier) @local.definition.parameter
|
||||
(accent_quoted) @local.definition.parameter
|
||||
]))
|
||||
type: (type_expression)? @local.definition.associated)
|
||||
|
||||
(concept_declaration
|
||||
parameters:
|
||||
(parameter_list
|
||||
[
|
||||
(identifier) @local.definition.parameter
|
||||
(accent_quoted
|
||||
(identifier) @local.definition.parameter)
|
||||
]))
|
||||
parameters: (parameter_list
|
||||
[
|
||||
(identifier) @local.definition.parameter
|
||||
(accent_quoted
|
||||
(identifier) @local.definition.parameter)
|
||||
]))
|
||||
|
||||
(var_parameter
|
||||
[
|
||||
|
@ -199,42 +185,39 @@
|
|||
; ==============================================================================
|
||||
; @local.definition.macro ; preprocessor macros
|
||||
(template_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.macro
|
||||
(accent_quoted) @local.definition.macro
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.macro)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.macro)
|
||||
]
|
||||
name: [
|
||||
(identifier) @local.definition.macro
|
||||
(accent_quoted) @local.definition.macro
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.macro)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.macro)
|
||||
]
|
||||
(#set! "definition.macro.scope" "parent"))
|
||||
|
||||
(macro_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.macro
|
||||
(accent_quoted) @local.definition.macro
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.macro)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.macro)
|
||||
]
|
||||
name: [
|
||||
(identifier) @local.definition.macro
|
||||
(accent_quoted) @local.definition.macro
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.macro)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.macro)
|
||||
]
|
||||
(#set! "definition.macro.scope" "parent"))
|
||||
|
||||
; ==============================================================================
|
||||
; @local.definition.type ; types or classes
|
||||
(type_declaration
|
||||
(type_symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.type
|
||||
(accent_quoted) @local.definition.type
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.type)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.type)
|
||||
]))
|
||||
name: [
|
||||
(identifier) @local.definition.type
|
||||
(accent_quoted) @local.definition.type
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.type)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.type)
|
||||
]))
|
||||
|
||||
; ==============================================================================
|
||||
; @local.definition.field ; fields or properties
|
||||
|
@ -246,15 +229,14 @@
|
|||
(field_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.field
|
||||
(accent_quoted) @local.definition.field
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.field)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.field)
|
||||
]))
|
||||
name: [
|
||||
(identifier) @local.definition.field
|
||||
(accent_quoted) @local.definition.field
|
||||
(exported_symbol
|
||||
(identifier) @local.definition.field)
|
||||
(exported_symbol
|
||||
(accent_quoted) @local.definition.field)
|
||||
]))
|
||||
type: (type_expression)? @local.definition.associated)
|
||||
|
||||
; ==============================================================================
|
||||
|
@ -262,11 +244,10 @@
|
|||
(enum_declaration
|
||||
(enum_field_declaration
|
||||
(symbol_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @local.definition.enum
|
||||
(accent_quoted) @local.definition.enum
|
||||
])))
|
||||
name: [
|
||||
(identifier) @local.definition.enum
|
||||
(accent_quoted) @local.definition.enum
|
||||
])))
|
||||
|
||||
; ==============================================================================
|
||||
; @local.definition.namespace ; modules or namespaces
|
||||
|
@ -285,19 +266,17 @@
|
|||
(expression_list
|
||||
(infix_expression
|
||||
operator: (operator) @_operator
|
||||
right:
|
||||
[
|
||||
(identifier) @local.definition.namespace
|
||||
(array_construction
|
||||
(identifier) @local.definition.namespace)
|
||||
]))
|
||||
right: [
|
||||
(identifier) @local.definition.namespace
|
||||
(array_construction
|
||||
(identifier) @local.definition.namespace)
|
||||
]))
|
||||
(#eq? @_operator "/"))
|
||||
|
||||
(import_from_statement
|
||||
module:
|
||||
(infix_expression
|
||||
operator: (operator) @_operator
|
||||
right: (identifier) @local.definition.namespace)
|
||||
module: (infix_expression
|
||||
operator: (operator) @_operator
|
||||
right: (identifier) @local.definition.namespace)
|
||||
(expression_list
|
||||
[
|
||||
(identifier) @local.definition.import
|
||||
|
|
|
@ -16,6 +16,5 @@
|
|||
type: (type)? @type)
|
||||
|
||||
(matching_curlies
|
||||
nim_expression:
|
||||
(nim_expression
|
||||
escaped_curly: (escaped_curly)+ @string.escape) @none)
|
||||
nim_expression: (nim_expression
|
||||
escaped_curly: (escaped_curly)+ @string.escape) @none)
|
||||
|
|
|
@ -65,9 +65,8 @@
|
|||
; ------------------
|
||||
(manifest
|
||||
(let
|
||||
name:
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin "builddir" "ninja_required_version"))))
|
||||
name: ((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin "builddir" "ninja_required_version"))))
|
||||
|
||||
; Rules bindings
|
||||
; -----------------
|
||||
|
|
|
@ -84,9 +84,8 @@
|
|||
|
||||
; function calls
|
||||
(apply_expression
|
||||
function:
|
||||
(variable_expression
|
||||
name: (identifier) @function.call))
|
||||
function: (variable_expression
|
||||
name: (identifier) @function.call))
|
||||
|
||||
; basic identifiers
|
||||
(variable_expression) @variable
|
||||
|
@ -101,12 +100,10 @@
|
|||
|
||||
; builtin functions (with builtins prefix)
|
||||
(select_expression
|
||||
expression:
|
||||
(variable_expression
|
||||
name: (identifier) @_id)
|
||||
attrpath:
|
||||
(attrpath
|
||||
attr: (identifier) @function.builtin)
|
||||
expression: (variable_expression
|
||||
name: (identifier) @_id)
|
||||
attrpath: (attrpath
|
||||
attr: (identifier) @function.builtin)
|
||||
(#eq? @_id "builtins"))
|
||||
|
||||
; builtin functions (without builtins prefix)
|
||||
|
@ -158,9 +155,8 @@
|
|||
|
||||
(select_expression
|
||||
expression: (_) @_expr
|
||||
attrpath:
|
||||
(attrpath
|
||||
attr: (identifier) @variable.member)
|
||||
attrpath: (attrpath
|
||||
attr: (identifier) @variable.member)
|
||||
(#not-eq? @_expr "builtins"))
|
||||
|
||||
(attrset_expression
|
||||
|
@ -179,9 +175,8 @@
|
|||
|
||||
; function definition
|
||||
(binding
|
||||
attrpath:
|
||||
(attrpath
|
||||
attr: (identifier) @function)
|
||||
attrpath: (attrpath
|
||||
attr: (identifier) @function)
|
||||
expression: (function_expression))
|
||||
|
||||
; unary operators
|
||||
|
|
|
@ -14,193 +14,165 @@
|
|||
|
||||
(apply_expression
|
||||
function: (_) @_func
|
||||
argument:
|
||||
[
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "regex")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "regex")))
|
||||
]
|
||||
argument: [
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "regex")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "regex")))
|
||||
]
|
||||
(#match? @_func "(^|\\.)match$")
|
||||
(#set! injection.combined))
|
||||
|
||||
(binding
|
||||
attrpath:
|
||||
(attrpath
|
||||
(identifier) @_path)
|
||||
expression:
|
||||
[
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
]
|
||||
attrpath: (attrpath
|
||||
(identifier) @_path)
|
||||
expression: [
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
]
|
||||
(#match? @_path "(^\\w+(Phase|Hook|Check)|(pre|post)[A-Z]\\w+|script)$"))
|
||||
|
||||
(apply_expression
|
||||
function: (_) @_func
|
||||
argument:
|
||||
argument: (_
|
||||
(_)*
|
||||
(_
|
||||
(_)*
|
||||
(_
|
||||
(_)*
|
||||
(binding
|
||||
attrpath:
|
||||
(attrpath
|
||||
(identifier) @_path)
|
||||
expression:
|
||||
[
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
])))
|
||||
(binding
|
||||
attrpath: (attrpath
|
||||
(identifier) @_path)
|
||||
expression: [
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
])))
|
||||
(#match? @_func "(^|\\.)writeShellApplication$")
|
||||
(#match? @_path "^text$")
|
||||
(#set! injection.combined))
|
||||
|
||||
(apply_expression
|
||||
function:
|
||||
(apply_expression
|
||||
function:
|
||||
(apply_expression
|
||||
function: (_) @_func))
|
||||
argument:
|
||||
[
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
]
|
||||
function: (apply_expression
|
||||
function: (apply_expression
|
||||
function: (_) @_func))
|
||||
argument: [
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
]
|
||||
(#match? @_func "(^|\\.)runCommand((No)?CC)?(Local)?$")
|
||||
(#set! injection.combined))
|
||||
|
||||
((apply_expression
|
||||
function:
|
||||
(apply_expression
|
||||
function: (_) @_func)
|
||||
argument:
|
||||
[
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
])
|
||||
function: (apply_expression
|
||||
function: (_) @_func)
|
||||
argument: [
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "bash")))
|
||||
])
|
||||
(#match? @_func "(^|\\.)write(Bash|Dash|ShellScript)(Bin)?$")
|
||||
(#set! injection.combined))
|
||||
|
||||
((apply_expression
|
||||
function:
|
||||
(apply_expression
|
||||
function: (_) @_func)
|
||||
argument:
|
||||
[
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "fish")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "fish")))
|
||||
])
|
||||
function: (apply_expression
|
||||
function: (_) @_func)
|
||||
argument: [
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "fish")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "fish")))
|
||||
])
|
||||
(#match? @_func "(^|\\.)writeFish(Bin)?$")
|
||||
(#set! injection.combined))
|
||||
|
||||
((apply_expression
|
||||
function:
|
||||
(apply_expression
|
||||
function:
|
||||
(apply_expression
|
||||
function: (_) @_func))
|
||||
argument:
|
||||
[
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "haskell")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "haskell")))
|
||||
])
|
||||
function: (apply_expression
|
||||
function: (apply_expression
|
||||
function: (_) @_func))
|
||||
argument: [
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "haskell")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "haskell")))
|
||||
])
|
||||
(#match? @_func "(^|\\.)writeHaskell(Bin)?$")
|
||||
(#set! injection.combined))
|
||||
|
||||
((apply_expression
|
||||
function:
|
||||
(apply_expression
|
||||
function:
|
||||
(apply_expression
|
||||
function: (_) @_func))
|
||||
argument:
|
||||
[
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "javascript")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "javascript")))
|
||||
])
|
||||
function: (apply_expression
|
||||
function: (apply_expression
|
||||
function: (_) @_func))
|
||||
argument: [
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "javascript")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "javascript")))
|
||||
])
|
||||
(#match? @_func "(^|\\.)writeJS(Bin)?$")
|
||||
(#set! injection.combined))
|
||||
|
||||
((apply_expression
|
||||
function:
|
||||
(apply_expression
|
||||
function:
|
||||
(apply_expression
|
||||
function: (_) @_func))
|
||||
argument:
|
||||
[
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "perl")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "perl")))
|
||||
])
|
||||
function: (apply_expression
|
||||
function: (apply_expression
|
||||
function: (_) @_func))
|
||||
argument: [
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "perl")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "perl")))
|
||||
])
|
||||
(#match? @_func "(^|\\.)writePerl(Bin)?$")
|
||||
(#set! injection.combined))
|
||||
|
||||
((apply_expression
|
||||
function:
|
||||
(apply_expression
|
||||
function:
|
||||
(apply_expression
|
||||
function: (_) @_func))
|
||||
argument:
|
||||
[
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "python")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "python")))
|
||||
])
|
||||
function: (apply_expression
|
||||
function: (apply_expression
|
||||
function: (_) @_func))
|
||||
argument: [
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "python")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "python")))
|
||||
])
|
||||
(#match? @_func "(^|\\.)write(PyPy|Python)[23](Bin)?$")
|
||||
(#set! injection.combined))
|
||||
|
||||
((apply_expression
|
||||
function:
|
||||
(apply_expression
|
||||
function:
|
||||
(apply_expression
|
||||
function: (_) @_func))
|
||||
argument:
|
||||
[
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "rust")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "rust")))
|
||||
])
|
||||
function: (apply_expression
|
||||
function: (apply_expression
|
||||
function: (_) @_func))
|
||||
argument: [
|
||||
(string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "rust")))
|
||||
(indented_string_expression
|
||||
((string_fragment) @injection.content
|
||||
(#set! injection.language "rust")))
|
||||
])
|
||||
(#match? @_func "(^|\\.)writeRust(Bin)?$")
|
||||
(#set! injection.combined))
|
||||
|
|
|
@ -244,12 +244,10 @@
|
|||
declarator: (identifier) @variable.parameter)
|
||||
|
||||
(parameter_declaration
|
||||
declarator:
|
||||
(function_declarator
|
||||
declarator:
|
||||
(parenthesized_declarator
|
||||
(block_pointer_declarator
|
||||
declarator: (identifier) @variable.parameter))))
|
||||
declarator: (function_declarator
|
||||
declarator: (parenthesized_declarator
|
||||
(block_pointer_declarator
|
||||
declarator: (identifier) @variable.parameter))))
|
||||
|
||||
"..." @variable.parameter.builtin
|
||||
|
||||
|
|
|
@ -40,11 +40,10 @@
|
|||
|
||||
(let_binding
|
||||
pattern: (value_name) @function
|
||||
body:
|
||||
[
|
||||
(fun_expression)
|
||||
(function_expression)
|
||||
])
|
||||
body: [
|
||||
(fun_expression)
|
||||
(function_expression)
|
||||
])
|
||||
|
||||
(value_specification
|
||||
(value_name) @function)
|
||||
|
@ -57,23 +56,20 @@
|
|||
; Application
|
||||
;------------
|
||||
(infix_expression
|
||||
left:
|
||||
(value_path
|
||||
(value_name) @function.call)
|
||||
left: (value_path
|
||||
(value_name) @function.call)
|
||||
operator: (concat_operator) @_operator
|
||||
(#eq? @_operator "@@"))
|
||||
|
||||
(infix_expression
|
||||
operator: (rel_operator) @_operator
|
||||
right:
|
||||
(value_path
|
||||
(value_name) @function.call)
|
||||
right: (value_path
|
||||
(value_name) @function.call)
|
||||
(#eq? @_operator "|>"))
|
||||
|
||||
(application_expression
|
||||
function:
|
||||
(value_path
|
||||
(value_name) @function.call))
|
||||
function: (value_path
|
||||
(value_name) @function.call))
|
||||
|
||||
((value_name) @function.builtin
|
||||
(#any-of? @function.builtin "raise" "raise_notrace" "failwith" "invalid_arg"))
|
||||
|
|
|
@ -28,16 +28,14 @@
|
|||
(#set! definition.var.scope "parent"))
|
||||
|
||||
(let_binding
|
||||
pattern:
|
||||
(tuple_pattern
|
||||
(value_name) @local.definition.var)
|
||||
pattern: (tuple_pattern
|
||||
(value_name) @local.definition.var)
|
||||
(#set! definition.var.scope "parent"))
|
||||
|
||||
(let_binding
|
||||
pattern:
|
||||
(record_pattern
|
||||
(field_pattern
|
||||
(value_name) @local.definition.var))
|
||||
pattern: (record_pattern
|
||||
(field_pattern
|
||||
(value_name) @local.definition.var))
|
||||
(#set! definition.var.scope "parent"))
|
||||
|
||||
(external
|
||||
|
|
|
@ -291,9 +291,8 @@
|
|||
name: (identifier) @type)
|
||||
|
||||
(declType
|
||||
name:
|
||||
(genericTpl
|
||||
entity: (identifier) @type))
|
||||
name: (genericTpl
|
||||
entity: (identifier) @type))
|
||||
|
||||
; -- Procedure & function declarations
|
||||
; foobar
|
||||
|
@ -302,23 +301,19 @@
|
|||
|
||||
; foobar<t>
|
||||
(declProc
|
||||
name:
|
||||
(genericTpl
|
||||
entity: (identifier) @function))
|
||||
name: (genericTpl
|
||||
entity: (identifier) @function))
|
||||
|
||||
; foo.bar
|
||||
(declProc
|
||||
name:
|
||||
(genericDot
|
||||
rhs: (identifier) @function))
|
||||
name: (genericDot
|
||||
rhs: (identifier) @function))
|
||||
|
||||
; foo.bar<t>
|
||||
(declProc
|
||||
name:
|
||||
(genericDot
|
||||
rhs:
|
||||
(genericTpl
|
||||
entity: (identifier) @function)))
|
||||
name: (genericDot
|
||||
rhs: (genericTpl
|
||||
entity: (identifier) @function)))
|
||||
|
||||
; Treat property declarations like functions
|
||||
(declProp
|
||||
|
@ -342,9 +337,8 @@
|
|||
type: (typeref) @type)
|
||||
|
||||
(declProc
|
||||
name:
|
||||
(genericDot
|
||||
lhs: (identifier) @type))
|
||||
name: (genericDot
|
||||
lhs: (identifier) @type))
|
||||
|
||||
(declType
|
||||
(genericDot
|
||||
|
@ -362,9 +356,8 @@
|
|||
entity: (identifier) @type)
|
||||
|
||||
(genericTpl
|
||||
entity:
|
||||
(genericDot
|
||||
(identifier) @type))
|
||||
entity: (genericDot
|
||||
(identifier) @type))
|
||||
|
||||
; -- Exception parameters
|
||||
(exceptionHandler
|
||||
|
@ -432,23 +425,19 @@
|
|||
|
||||
; foobar<t>
|
||||
(exprCall
|
||||
entity:
|
||||
(exprTpl
|
||||
entity: (identifier) @function))
|
||||
entity: (exprTpl
|
||||
entity: (identifier) @function))
|
||||
|
||||
; foo.bar
|
||||
(exprCall
|
||||
entity:
|
||||
(exprDot
|
||||
rhs: (identifier) @function))
|
||||
entity: (exprDot
|
||||
rhs: (identifier) @function))
|
||||
|
||||
; foo.bar<t>
|
||||
(exprCall
|
||||
entity:
|
||||
(exprDot
|
||||
rhs:
|
||||
(exprTpl
|
||||
entity: (identifier) @function)))
|
||||
entity: (exprDot
|
||||
rhs: (exprTpl
|
||||
entity: (identifier) @function)))
|
||||
|
||||
(inherited) @function
|
||||
|
||||
|
@ -469,9 +458,8 @@
|
|||
|
||||
(statement
|
||||
(exprDot
|
||||
rhs:
|
||||
(exprTpl
|
||||
entity: (identifier) @function)))
|
||||
rhs: (exprTpl
|
||||
entity: (identifier) @function)))
|
||||
|
||||
; -- Break, Continue & Exit
|
||||
; (Not ideal: ideally, there would be a way to check if these special
|
||||
|
@ -482,9 +470,8 @@
|
|||
|
||||
(statement
|
||||
(exprCall
|
||||
entity:
|
||||
((identifier) @keyword.return
|
||||
(#lua-match? @keyword.return "^[eE][xX][iI][tT]$"))))
|
||||
entity: ((identifier) @keyword.return
|
||||
(#lua-match? @keyword.return "^[eE][xX][iI][tT]$"))))
|
||||
|
||||
(statement
|
||||
((identifier) @keyword.repeat
|
||||
|
@ -505,9 +492,8 @@
|
|||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
|
||||
|
||||
(assignment
|
||||
rhs:
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
|
||||
rhs: ((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
|
||||
|
||||
(exprBrackets
|
||||
((identifier) @constant
|
||||
|
@ -518,14 +504,12 @@
|
|||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
|
||||
|
||||
(exprDot
|
||||
rhs:
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
|
||||
rhs: ((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
|
||||
|
||||
(exprTpl
|
||||
args:
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
|
||||
args: ((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
|
||||
|
||||
(exprArgs
|
||||
((identifier) @constant
|
||||
|
|
|
@ -45,9 +45,8 @@
|
|||
name: (identifier) @local.definition)
|
||||
|
||||
(declType
|
||||
name:
|
||||
(genericTpl
|
||||
entity: (identifier) @local.definition))
|
||||
name: (genericTpl
|
||||
entity: (identifier) @local.definition))
|
||||
|
||||
(declProc
|
||||
name: (identifier) @local.definition)
|
||||
|
|
|
@ -60,12 +60,11 @@
|
|||
])
|
||||
|
||||
(scoped_call_expression
|
||||
scope:
|
||||
[
|
||||
(name) @type
|
||||
(qualified_name
|
||||
(name) @type)
|
||||
])
|
||||
scope: [
|
||||
(name) @type
|
||||
(qualified_name
|
||||
(name) @type)
|
||||
])
|
||||
|
||||
(class_constant_access_expression
|
||||
.
|
||||
|
@ -84,12 +83,11 @@
|
|||
|
||||
(binary_expression
|
||||
operator: "instanceof"
|
||||
right:
|
||||
[
|
||||
(name) @type
|
||||
(qualified_name
|
||||
(name) @type)
|
||||
])
|
||||
right: [
|
||||
(name) @type
|
||||
(qualified_name
|
||||
(name) @type)
|
||||
])
|
||||
|
||||
; Functions, methods, constructors
|
||||
(array_creation_expression
|
||||
|
@ -102,9 +100,8 @@
|
|||
name: (name) @function.method)
|
||||
|
||||
(function_call_expression
|
||||
function:
|
||||
(qualified_name
|
||||
(name) @function.call))
|
||||
function: (qualified_name
|
||||
(name) @function.call))
|
||||
|
||||
(function_call_expression
|
||||
(name) @function.call)
|
||||
|
@ -146,17 +143,15 @@
|
|||
(variable_name) @property)
|
||||
|
||||
(member_access_expression
|
||||
name:
|
||||
(variable_name
|
||||
(name)) @variable.member)
|
||||
name: (variable_name
|
||||
(name)) @variable.member)
|
||||
|
||||
(member_access_expression
|
||||
name: (name) @variable.member)
|
||||
|
||||
(nullsafe_member_access_expression
|
||||
name:
|
||||
(variable_name
|
||||
(name)) @variable.member)
|
||||
name: (variable_name
|
||||
(name)) @variable.member)
|
||||
|
||||
(nullsafe_member_access_expression
|
||||
name: (name) @variable.member)
|
||||
|
@ -169,9 +164,8 @@
|
|||
|
||||
; Namespace
|
||||
(namespace_definition
|
||||
name:
|
||||
(namespace_name
|
||||
(name) @module))
|
||||
name: (namespace_name
|
||||
(name) @module))
|
||||
|
||||
(namespace_name_as_prefix
|
||||
(namespace_name
|
||||
|
|
|
@ -16,24 +16,22 @@
|
|||
; regex
|
||||
((function_call_expression
|
||||
function: (_) @_preg_func_identifier
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(argument
|
||||
(_
|
||||
(string_value) @injection.content))))
|
||||
arguments: (arguments
|
||||
.
|
||||
(argument
|
||||
(_
|
||||
(string_value) @injection.content))))
|
||||
(#set! injection.language "regex")
|
||||
(#lua-match? @_preg_func_identifier "^preg_"))
|
||||
|
||||
; bash
|
||||
((function_call_expression
|
||||
function: (_) @_shell_func_identifier
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(argument
|
||||
(_
|
||||
(string_value) @injection.content))))
|
||||
arguments: (arguments
|
||||
.
|
||||
(argument
|
||||
(_
|
||||
(string_value) @injection.content))))
|
||||
(#set! injection.language "bash")
|
||||
(#any-of? @_shell_func_identifier
|
||||
"shell_exec" "escapeshellarg" "escapeshellcmd" "exec" "passthru" "proc_open" "shell_exec"
|
||||
|
|
|
@ -67,10 +67,9 @@
|
|||
(#set! reference.kind "method"))
|
||||
|
||||
(function_call_expression
|
||||
function:
|
||||
(qualified_name
|
||||
(name) @local.reference
|
||||
(#set! reference.kind "function")))
|
||||
function: (qualified_name
|
||||
(name) @local.reference
|
||||
(#set! reference.kind "function")))
|
||||
|
||||
(object_creation_expression
|
||||
(qualified_name
|
||||
|
@ -78,9 +77,8 @@
|
|||
(#set! reference.kind "type")))
|
||||
|
||||
(scoped_call_expression
|
||||
scope:
|
||||
(qualified_name
|
||||
(name) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
scope: (qualified_name
|
||||
(name) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
name: (name) @local.reference
|
||||
(#set! reference.kind "method"))
|
||||
|
|
|
@ -133,15 +133,14 @@
|
|||
(#set! "priority" 105))
|
||||
|
||||
(call_expression
|
||||
callee:
|
||||
[
|
||||
(identifier) @function.method.call
|
||||
(ffi_identifier
|
||||
(identifier) @function.method.call)
|
||||
(member_expression
|
||||
"."
|
||||
(identifier) @function.method.call)
|
||||
])
|
||||
callee: [
|
||||
(identifier) @function.method.call
|
||||
(ffi_identifier
|
||||
(identifier) @function.method.call)
|
||||
(member_expression
|
||||
"."
|
||||
(identifier) @function.method.call)
|
||||
])
|
||||
|
||||
; Parameters
|
||||
(parameter
|
||||
|
@ -168,22 +167,20 @@
|
|||
|
||||
; Operators
|
||||
(unary_expression
|
||||
operator:
|
||||
[
|
||||
"not"
|
||||
"addressof"
|
||||
"digestof"
|
||||
] @keyword.operator)
|
||||
operator: [
|
||||
"not"
|
||||
"addressof"
|
||||
"digestof"
|
||||
] @keyword.operator)
|
||||
|
||||
(binary_expression
|
||||
operator:
|
||||
[
|
||||
"and"
|
||||
"or"
|
||||
"xor"
|
||||
"is"
|
||||
"isnt"
|
||||
] @keyword.operator)
|
||||
operator: [
|
||||
"and"
|
||||
"or"
|
||||
"xor"
|
||||
"is"
|
||||
"isnt"
|
||||
] @keyword.operator)
|
||||
|
||||
[
|
||||
"="
|
||||
|
|
|
@ -42,9 +42,8 @@
|
|||
name: (identifier) @attribute)
|
||||
|
||||
(attribute
|
||||
name:
|
||||
(variable
|
||||
(identifier) @attribute))
|
||||
name: (variable
|
||||
(identifier) @attribute))
|
||||
|
||||
; Parameters
|
||||
(lambda
|
||||
|
|
|
@ -35,9 +35,8 @@
|
|||
|
||||
((assignment
|
||||
left: (identifier) @type.definition
|
||||
right:
|
||||
(call
|
||||
function: (identifier) @_func))
|
||||
right: (call
|
||||
function: (identifier) @_func))
|
||||
(#any-of? @_func "TypeVar" "NewType"))
|
||||
|
||||
; Function calls
|
||||
|
@ -45,18 +44,16 @@
|
|||
function: (identifier) @function.call)
|
||||
|
||||
(call
|
||||
function:
|
||||
(attribute
|
||||
attribute: (identifier) @function.method.call))
|
||||
function: (attribute
|
||||
attribute: (identifier) @function.method.call))
|
||||
|
||||
((call
|
||||
function: (identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call
|
||||
function:
|
||||
(attribute
|
||||
attribute: (identifier) @constructor))
|
||||
function: (attribute
|
||||
attribute: (identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
; Decorators
|
||||
|
@ -109,10 +106,9 @@
|
|||
|
||||
((call
|
||||
function: (identifier) @_isinstance
|
||||
arguments:
|
||||
(argument_list
|
||||
(_)
|
||||
(identifier) @type))
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
(identifier) @type))
|
||||
(#eq? @_isinstance "isinstance"))
|
||||
|
||||
; Normal parameters
|
||||
|
@ -211,18 +207,16 @@
|
|||
(string) @string.documentation @spell))
|
||||
|
||||
(class_definition
|
||||
body:
|
||||
(block
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation @spell)))
|
||||
body: (block
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation @spell)))
|
||||
|
||||
(function_definition
|
||||
body:
|
||||
(block
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation @spell)))
|
||||
body: (block
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation @spell)))
|
||||
|
||||
; Tokens
|
||||
[
|
||||
|
@ -378,32 +372,27 @@
|
|||
name: (identifier) @type)
|
||||
|
||||
(class_definition
|
||||
body:
|
||||
(block
|
||||
(function_definition
|
||||
name: (identifier) @function.method)))
|
||||
body: (block
|
||||
(function_definition
|
||||
name: (identifier) @function.method)))
|
||||
|
||||
(class_definition
|
||||
superclasses:
|
||||
(argument_list
|
||||
(identifier) @type))
|
||||
superclasses: (argument_list
|
||||
(identifier) @type))
|
||||
|
||||
((class_definition
|
||||
body:
|
||||
(block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (identifier) @variable.member))))
|
||||
body: (block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (identifier) @variable.member))))
|
||||
(#lua-match? @variable.member "^[%l_].*$"))
|
||||
|
||||
((class_definition
|
||||
body:
|
||||
(block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left:
|
||||
(_
|
||||
(identifier) @variable.member)))))
|
||||
body: (block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (_
|
||||
(identifier) @variable.member)))))
|
||||
(#lua-match? @variable.member "^[%l_].*$"))
|
||||
|
||||
((class_definition
|
||||
|
@ -434,12 +423,10 @@
|
|||
|
||||
; Regex from the `re` module
|
||||
(call
|
||||
function:
|
||||
(attribute
|
||||
object: (identifier) @_re)
|
||||
arguments:
|
||||
(argument_list
|
||||
.
|
||||
(string
|
||||
(string_content) @string.regexp))
|
||||
function: (attribute
|
||||
object: (identifier) @_re)
|
||||
arguments: (argument_list
|
||||
.
|
||||
(string
|
||||
(string_content) @string.regexp))
|
||||
(#eq? @_re "re"))
|
||||
|
|
|
@ -164,9 +164,8 @@
|
|||
(attribute
|
||||
attribute: (_) @indent.end)
|
||||
(call
|
||||
arguments:
|
||||
(_
|
||||
")" @indent.end))
|
||||
arguments: (_
|
||||
")" @indent.end))
|
||||
"return" @indent.end
|
||||
] .)
|
||||
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
(call
|
||||
function:
|
||||
(attribute
|
||||
object: (identifier) @_re)
|
||||
arguments:
|
||||
(argument_list
|
||||
.
|
||||
(string
|
||||
(string_content) @injection.content))
|
||||
function: (attribute
|
||||
object: (identifier) @_re)
|
||||
arguments: (argument_list
|
||||
.
|
||||
(string
|
||||
(string_content) @injection.content))
|
||||
(#eq? @_re "re")
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
((binary_operator
|
||||
left:
|
||||
(string
|
||||
(string_content) @injection.content)
|
||||
left: (string
|
||||
(string_content) @injection.content)
|
||||
operator: "%")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
|
|
|
@ -2,34 +2,29 @@
|
|||
(module) @local.scope
|
||||
|
||||
(class_definition
|
||||
body:
|
||||
(block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (identifier) @local.definition.field)))) @local.scope
|
||||
body: (block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (identifier) @local.definition.field)))) @local.scope
|
||||
|
||||
(class_definition
|
||||
body:
|
||||
(block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left:
|
||||
(_
|
||||
(identifier) @local.definition.field))))) @local.scope
|
||||
body: (block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (_
|
||||
(identifier) @local.definition.field))))) @local.scope
|
||||
|
||||
; Imports
|
||||
(aliased_import
|
||||
alias: (identifier) @local.definition.import)
|
||||
|
||||
(import_statement
|
||||
name:
|
||||
(dotted_name
|
||||
(identifier) @local.definition.import))
|
||||
name: (dotted_name
|
||||
(identifier) @local.definition.import))
|
||||
|
||||
(import_from_statement
|
||||
name:
|
||||
(dotted_name
|
||||
(identifier) @local.definition.import))
|
||||
name: (dotted_name
|
||||
(identifier) @local.definition.import))
|
||||
|
||||
; Function with parameters, defines parameters
|
||||
(parameters
|
||||
|
@ -64,22 +59,19 @@
|
|||
(#set! definition.type.scope "parent"))
|
||||
|
||||
(class_definition
|
||||
body:
|
||||
(block
|
||||
(function_definition
|
||||
name: (identifier) @local.definition.method)))
|
||||
body: (block
|
||||
(function_definition
|
||||
name: (identifier) @local.definition.method)))
|
||||
|
||||
; Loops
|
||||
; not a scope!
|
||||
(for_statement
|
||||
left:
|
||||
(pattern_list
|
||||
(identifier) @local.definition.var))
|
||||
left: (pattern_list
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(for_statement
|
||||
left:
|
||||
(tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
left: (tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(for_statement
|
||||
left: (identifier) @local.definition.var)
|
||||
|
@ -91,14 +83,12 @@
|
|||
left: (identifier) @local.definition.var)
|
||||
|
||||
(for_in_clause
|
||||
left:
|
||||
(tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
left: (tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(for_in_clause
|
||||
left:
|
||||
(pattern_list
|
||||
(identifier) @local.definition.var))
|
||||
left: (pattern_list
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(dictionary_comprehension) @local.scope
|
||||
|
||||
|
@ -111,20 +101,17 @@
|
|||
left: (identifier) @local.definition.var)
|
||||
|
||||
(assignment
|
||||
left:
|
||||
(pattern_list
|
||||
(identifier) @local.definition.var))
|
||||
left: (pattern_list
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(assignment
|
||||
left:
|
||||
(tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
left: (tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(assignment
|
||||
left:
|
||||
(attribute
|
||||
(identifier)
|
||||
(identifier) @local.definition.field))
|
||||
left: (attribute
|
||||
(identifier)
|
||||
(identifier) @local.definition.field))
|
||||
|
||||
; Walrus operator x := 1
|
||||
(named_expression
|
||||
|
|
|
@ -4,12 +4,11 @@
|
|||
; Annotations
|
||||
(ui_annotation
|
||||
"@" @operator
|
||||
type_name:
|
||||
[
|
||||
(identifier) @attribute
|
||||
(nested_identifier
|
||||
(identifier) @attribute)
|
||||
])
|
||||
type_name: [
|
||||
(identifier) @attribute
|
||||
(nested_identifier
|
||||
(identifier) @attribute)
|
||||
])
|
||||
|
||||
; type
|
||||
(ui_property
|
||||
|
@ -17,28 +16,25 @@
|
|||
|
||||
; Properties
|
||||
(ui_object_definition_binding
|
||||
name:
|
||||
[
|
||||
(identifier) @property
|
||||
(nested_identifier
|
||||
(identifier) @property)
|
||||
])
|
||||
name: [
|
||||
(identifier) @property
|
||||
(nested_identifier
|
||||
(identifier) @property)
|
||||
])
|
||||
|
||||
(ui_binding
|
||||
name:
|
||||
[
|
||||
(identifier) @property
|
||||
(nested_identifier
|
||||
(identifier) @property)
|
||||
])
|
||||
name: [
|
||||
(identifier) @property
|
||||
(nested_identifier
|
||||
(identifier) @property)
|
||||
])
|
||||
|
||||
; locals query appears not working unless id: <ref> isn't a parameter.
|
||||
(ui_binding
|
||||
name: (identifier) @property
|
||||
(#eq? @property "id")
|
||||
value:
|
||||
(expression_statement
|
||||
(identifier) @variable))
|
||||
value: (expression_statement
|
||||
(identifier) @variable))
|
||||
|
||||
(ui_property
|
||||
name: (identifier) @property)
|
||||
|
@ -77,10 +73,9 @@
|
|||
|
||||
; function
|
||||
(call_expression
|
||||
function:
|
||||
(member_expression
|
||||
object: (identifier) @variable
|
||||
property: (property_identifier) @function))
|
||||
function: (member_expression
|
||||
object: (identifier) @variable
|
||||
property: (property_identifier) @function))
|
||||
|
||||
; js
|
||||
; Literals
|
||||
|
|
|
@ -68,20 +68,18 @@
|
|||
|
||||
((predicate
|
||||
name: (identifier) @_name
|
||||
parameters:
|
||||
(parameters
|
||||
(string
|
||||
"\"" @string
|
||||
"\"" @string) @string.regexp))
|
||||
parameters: (parameters
|
||||
(string
|
||||
"\"" @string
|
||||
"\"" @string) @string.regexp))
|
||||
(#any-of? @_name "match" "not-match" "vim-match" "not-vim-match" "lua-match" "not-lua-match"))
|
||||
|
||||
((predicate
|
||||
name: (identifier) @_name
|
||||
parameters:
|
||||
(parameters
|
||||
(string
|
||||
"\"" @string
|
||||
"\"" @string) @string.regexp
|
||||
.
|
||||
(string) .))
|
||||
parameters: (parameters
|
||||
(string
|
||||
"\"" @string
|
||||
"\"" @string) @string.regexp
|
||||
.
|
||||
(string) .))
|
||||
(#any-of? @_name "gsub" "not-gsub"))
|
||||
|
|
|
@ -1,28 +1,25 @@
|
|||
((predicate
|
||||
name: (identifier) @_name
|
||||
parameters:
|
||||
(parameters
|
||||
(string) @injection.content))
|
||||
parameters: (parameters
|
||||
(string) @injection.content))
|
||||
(#any-of? @_name "match" "not-match" "vim-match" "not-vim-match")
|
||||
(#set! injection.language "regex")
|
||||
(#offset! @injection.content 0 1 0 -1))
|
||||
|
||||
((predicate
|
||||
name: (identifier) @_name
|
||||
parameters:
|
||||
(parameters
|
||||
(string) @injection.content))
|
||||
parameters: (parameters
|
||||
(string) @injection.content))
|
||||
(#any-of? @_name "lua-match" "not-lua-match")
|
||||
(#set! injection.language "luap")
|
||||
(#offset! @injection.content 0 1 0 -1))
|
||||
|
||||
((predicate
|
||||
name: (identifier) @_name
|
||||
parameters:
|
||||
(parameters
|
||||
(string) @injection.content
|
||||
.
|
||||
(string) .))
|
||||
parameters: (parameters
|
||||
(string) @injection.content
|
||||
.
|
||||
(string) .))
|
||||
(#any-of? @_name "gsub" "not-gsub")
|
||||
(#set! injection.language "luap")
|
||||
(#offset! @injection.content 0 1 0 -1))
|
||||
|
|
|
@ -55,36 +55,34 @@
|
|||
] @operator
|
||||
|
||||
(unary
|
||||
operator:
|
||||
[
|
||||
"-"
|
||||
"+"
|
||||
"!"
|
||||
"~"
|
||||
"?"
|
||||
] @operator)
|
||||
operator: [
|
||||
"-"
|
||||
"+"
|
||||
"!"
|
||||
"~"
|
||||
"?"
|
||||
] @operator)
|
||||
|
||||
(binary
|
||||
operator:
|
||||
[
|
||||
"-"
|
||||
"+"
|
||||
"*"
|
||||
"/"
|
||||
"^"
|
||||
"<"
|
||||
">"
|
||||
"<="
|
||||
">="
|
||||
"=="
|
||||
"!="
|
||||
"||"
|
||||
"|"
|
||||
"&&"
|
||||
"&"
|
||||
":"
|
||||
"~"
|
||||
] @operator)
|
||||
operator: [
|
||||
"-"
|
||||
"+"
|
||||
"*"
|
||||
"/"
|
||||
"^"
|
||||
"<"
|
||||
">"
|
||||
"<="
|
||||
">="
|
||||
"=="
|
||||
"!="
|
||||
"||"
|
||||
"|"
|
||||
"&&"
|
||||
"&"
|
||||
":"
|
||||
"~"
|
||||
] @operator)
|
||||
|
||||
[
|
||||
"|>"
|
||||
|
@ -157,7 +155,6 @@
|
|||
function: (identifier) @function.call))
|
||||
|
||||
(call
|
||||
function:
|
||||
(dollar
|
||||
_
|
||||
(identifier) @function.method.call))
|
||||
function: (dollar
|
||||
_
|
||||
(identifier) @function.method.call))
|
||||
|
|
|
@ -44,14 +44,12 @@
|
|||
(number) @number
|
||||
|
||||
(expr_call
|
||||
func_name:
|
||||
(fn_name
|
||||
(var) @function .))
|
||||
func_name: (fn_name
|
||||
(var) @function .))
|
||||
|
||||
(expr_call
|
||||
func_arguments:
|
||||
(fn_args
|
||||
(expr) @variable.parameter))
|
||||
func_arguments: (fn_args
|
||||
(expr) @variable.parameter))
|
||||
|
||||
(rule_args
|
||||
(term) @variable.parameter)
|
||||
|
|
|
@ -8,11 +8,10 @@
|
|||
"END" @indent.branch)
|
||||
|
||||
(for_statement
|
||||
right:
|
||||
(_
|
||||
(arguments
|
||||
(continuation
|
||||
(ellipses) @indent.branch))))
|
||||
right: (_
|
||||
(arguments
|
||||
(continuation
|
||||
(ellipses) @indent.branch))))
|
||||
|
||||
(while_statement) @indent.begin
|
||||
|
||||
|
|
|
@ -22,9 +22,8 @@
|
|||
name: (type) @function)
|
||||
|
||||
(directive
|
||||
body:
|
||||
(body
|
||||
(arguments) @variable.parameter))
|
||||
body: (body
|
||||
(arguments) @variable.parameter))
|
||||
|
||||
((directive
|
||||
name: (type) @keyword.import)
|
||||
|
@ -143,9 +142,8 @@
|
|||
|
||||
(directive
|
||||
name: (type) @_directive
|
||||
body:
|
||||
(body
|
||||
(content) @spell
|
||||
(#not-any-of? @_directive "code" "code-block" "sourcecode")))
|
||||
body: (body
|
||||
(content) @spell
|
||||
(#not-any-of? @_directive "code" "code-block" "sourcecode")))
|
||||
|
||||
(paragraph) @spell
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue