mirror of https://github.com/helix-editor/helix
queries: `bar` in `let bar = || 4` is a function
parent
b5a07f9974
commit
9de1c7213b
|
@ -310,6 +310,13 @@
|
||||||
; Functions
|
; Functions
|
||||||
; -------
|
; -------
|
||||||
|
|
||||||
|
; In here, `bar` is a function, as it is equal to a closure:
|
||||||
|
;
|
||||||
|
; let bar = || 4;
|
||||||
|
(let_declaration
|
||||||
|
pattern: (identifier) @function
|
||||||
|
value: (closure_expression))
|
||||||
|
|
||||||
; highlight `baz` in `any_function(foo::bar::baz)` as function
|
; highlight `baz` in `any_function(foo::bar::baz)` as function
|
||||||
; This generically works for an unlimited number of path segments:
|
; This generically works for an unlimited number of path segments:
|
||||||
;
|
;
|
||||||
|
@ -322,10 +329,10 @@
|
||||||
; that position, however you cannot pass modules as arguments
|
; that position, however you cannot pass modules as arguments
|
||||||
(call_expression
|
(call_expression
|
||||||
function: _
|
function: _
|
||||||
arguments: (arguments "("
|
arguments: (arguments
|
||||||
(scoped_identifier
|
(scoped_identifier
|
||||||
path: _
|
path: _
|
||||||
name: (identifier) @function) ")"))
|
name: (identifier) @function)))
|
||||||
|
|
||||||
; Special handling for point-free functions that are not part of a path
|
; Special handling for point-free functions that are not part of a path
|
||||||
; but are just passed as variables to some "well-known"
|
; but are just passed as variables to some "well-known"
|
||||||
|
@ -338,7 +345,7 @@
|
||||||
field: (field_identifier) @_method_name)
|
field: (field_identifier) @_method_name)
|
||||||
arguments:
|
arguments:
|
||||||
; first argument is `@function`
|
; first argument is `@function`
|
||||||
(arguments "("
|
(arguments
|
||||||
.
|
.
|
||||||
(identifier) @function)
|
(identifier) @function)
|
||||||
(#any-of? @_method_name
|
(#any-of? @_method_name
|
||||||
|
@ -420,13 +427,13 @@
|
||||||
field: (field_identifier) @_method_name)
|
field: (field_identifier) @_method_name)
|
||||||
arguments:
|
arguments:
|
||||||
; handles `a.map_or_else(..., foo)`
|
; handles `a.map_or_else(..., foo)`
|
||||||
(arguments "("
|
(arguments
|
||||||
; first argument is ignored
|
; first argument is ignored
|
||||||
.
|
.
|
||||||
_
|
_
|
||||||
.
|
.
|
||||||
; second argument is @function
|
; second argument is @function
|
||||||
(identifier) @function ")")
|
(identifier) @function)
|
||||||
(#any-of? @_method_name
|
(#any-of? @_method_name
|
||||||
; methods on `Option`
|
; methods on `Option`
|
||||||
"map_or_else" "zip_with"
|
"map_or_else" "zip_with"
|
||||||
|
|
Loading…
Reference in New Issue