on 0b8a00a help sign in
helix/runtime/queries/elixir/textobjects.scm
27 lines 890 B history raw
1; Function heads and guards have no body at all, so `keywords` and `do_block` nodes are both optional
2((call
3 target: (identifier) @_keyword
4 (arguments
5 [
6 (call
7 (arguments (_)? @parameter.inside))
8 ; function has a guard
9 (binary_operator
10 left:
11 (call
12 (arguments (_)? @parameter.inside)))
13 ]
14 ; body is "do: body" instead of a do-block
15 (keywords
16 (pair
17 value: (_) @function.inside))?)?
18 (do_block (_)* @function.inside)?)
19 (#match? @_keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp|test|describe|setup)$")) @function.around
21(anonymous_function
22 (stab_clause right: (body) @function.inside)) @function.around
24((call
25 target: (identifier) @_keyword
26 (do_block (_)* @class.inside))
27 (#match? @_keyword "^(defmodule|defprotocol|defimpl)$")) @class.around