| 1 | ; Definitions |
| 2 | |
| 3 | ; * modules and protocols |
| 4 | (call |
| 5 | target: (identifier) @ignore |
| 6 | (arguments (alias) @name.definition.module) |
| 7 | (#match? @ignore "^(defmodule|defprotocol)$")) @definition.module |
| 8 | |
| 9 | ; * functions/macros |
| 10 | (call |
| 11 | target: (identifier) @ignore |
| 12 | (arguments |
| 13 | [ |
| 14 | ; zero-arity functions with no parentheses |
| 15 | (identifier) @name.definition.function |
| 16 | ; regular function clause |
| 17 | (call target: (identifier) @name.definition.function) |
| 18 | ; function clause with a guard clause |
| 19 | (binary_operator |
| 20 | left: (call target: (identifier) @name.definition.function) |
| 21 | operator: "when") |
| 22 | ]) |
| 23 | (#match? @ignore "^(def|defp|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp)$")) @definition.function |
| 24 | |
| 25 | ; * modules |
| 26 | (alias) @name.reference.module @reference.module |