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 (function_definition
name: (word) @function) name: (word) @function)
(command_name (word) @function) (command_name (word) @function.call)
((command_name (word) @function.builtin) ((command_name (word) @function.builtin)
(#any-of? @function.builtin (#any-of? @function.builtin

View file

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

View file

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

View file

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

View file

@ -161,10 +161,10 @@
(parameters (identifier) @parameter) (parameters (identifier) @parameter)
(function_call name: (identifier) @function) (function_call name: (identifier) @function.call)
(function_declaration name: (identifier) @function) (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)) (function_declaration name: (dot_index_expression field: (identifier) @function))
(method_index_expression method: (identifier) @method) (method_index_expression method: (identifier) @method)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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