Split func/method definition from calls in several programming language queries

This commit is contained in:
lfenzo 2022-07-29 21:09:58 -03:00 committed by Stephan Seitz
parent 77675b6706
commit c784720917
15 changed files with 32 additions and 32 deletions

View file

@ -97,7 +97,7 @@
(function_definition
name: (word) @function)
(command_name (word) @function)
(command_name (word) @function.call)
((command_name (word) @function.builtin)
(#any-of? @function.builtin

View file

@ -84,13 +84,13 @@
(stab_clause operator: _ @operator)
; Local Function Calls
(call target: (identifier) @function)
(call target: (identifier) @function.call)
; Remote Function Calls
(call target: (dot left: [
(atom) @type
(_)
] right: (identifier) @function) (arguments))
] right: (identifier) @function.call) (arguments))
; Definition Function Calls
(call target: ((identifier) @keyword.function (#any-of? @keyword.function

View file

@ -59,7 +59,7 @@
)
;;; expr_function_call
(expr_function_call
name: (computed_function_name) @function
name: (computed_function_name) @function.call
)
(expr_function_call

View file

@ -9,7 +9,7 @@
(method_declaration
name: (identifier) @method)
(method_invocation
name: (identifier) @method)
name: (identifier) @method.call)
(super) @function.builtin

View file

@ -161,10 +161,10 @@
(parameters (identifier) @parameter)
(function_call name: (identifier) @function)
(function_call name: (identifier) @function.call)
(function_declaration name: (identifier) @function)
(function_call name: (dot_index_expression field: (identifier) @function))
(function_call name: (dot_index_expression field: (identifier) @function.call))
(function_declaration name: (dot_index_expression field: (identifier) @function))
(method_index_expression method: (identifier) @method)

View file

@ -89,9 +89,9 @@
(pod_statement) @text
(method_invocation
function_name: (identifier) @method)
function_name: (identifier) @method.call)
(call_expression
function_name: (identifier) @function)
function_name: (identifier) @function.call)
;; ----------

View file

@ -42,16 +42,16 @@
name: (name) @method)
(function_call_expression
function: (qualified_name (name)) @function)
function: (qualified_name (name)) @function.call)
(function_call_expression
(name) @function)
(name) @function.call)
(scoped_call_expression
name: (name) @function)
name: (name) @function.call)
(member_call_expression
name: (name) @method)
name: (name) @method.call)
(function_definition
name: (name) @function)

View file

@ -70,7 +70,7 @@
method: [
(identifier)
(constant)
] @function
] @function.call
)
(program

View file

@ -39,22 +39,22 @@
; Function calls
(call_expression
function: (identifier) @function)
function: (identifier) @function.call)
(call_expression
function: (scoped_identifier
(identifier) @function .))
(identifier) @function.call .))
(call_expression
function: (field_expression
field: (field_identifier) @function))
field: (field_identifier) @function.call))
(generic_function
function: (identifier) @function)
function: (identifier) @function.call)
(generic_function
function: (scoped_identifier
name: (identifier) @function))
name: (identifier) @function.call))
(generic_function
function: (field_expression
field: (field_identifier) @function))
field: (field_identifier) @function.call))
; Assume other uppercase names are enum constructors
((field_identifier) @constant

View file

@ -65,18 +65,18 @@
(call_expression
function: (identifier) @function)
function: (identifier) @function.call)
(call_expression
function: (field_expression
field: (identifier) @method))
field: (identifier) @method.call))
((call_expression
function: (identifier) @constructor)
(#lua-match? @constructor "^[A-Z]"))
(generic_function
function: (identifier) @function)
function: (identifier) @function.call)
(
(identifier) @function.builtin

View file

@ -1,10 +1,10 @@
(function_call
(invocation
name: (identifier) @function
name: (identifier) @function.call
parameter: [(field)]? @parameter))
(function_call
name: (identifier) @function
name: (identifier) @function.call
parameter: [(field)]? @parameter)
(table_expression

View file

@ -54,10 +54,10 @@
(enum_entry ["case" @keyword])
; Function calls
(call_expression (simple_identifier) @function) ; foo()
(call_expression (simple_identifier) @function.call) ; foo()
(call_expression ; foo.bar.baz(): highlight the baz()
(navigation_expression
(navigation_suffix (simple_identifier) @function)))
(navigation_suffix (simple_identifier) @function.call)))
((navigation_expression
(simple_identifier) @type) ; SomeType.method(): highlight SomeType as a type
(#lua-match? @type "^[A-Z]"))

View file

@ -41,16 +41,16 @@
;; Function calls ----------------
(call_expression
function: (identifier) @function)
function: (identifier) @function.call)
(((_
function: (selector_expression field: (identifier) @function)
function: (selector_expression field: (identifier) @function.call)
arguments: (_) @_args)
(#not-has-type? @_args arguments_list)))
((call_expression
function: (binded_identifier name: (identifier) @function)
@function))
@function.call))
;; Function definitions ---------

View file

@ -34,7 +34,7 @@
;; Function related
(function_declaration name: (_) @function)
(call_expression function: (identifier) @function)
(call_expression function: (identifier) @function.call)
(parameters (identifier) @parameter)
(default_parameter (identifier) @parameter)

View file

@ -51,7 +51,7 @@ parameter: (IDENTIFIER) @parameter
[
function_call: (IDENTIFIER)
function: (IDENTIFIER)
] @function
] @function.call
exception: "!" @exception