refactor: Update elixir-tags.scm to use more specific @name.reference and @name.definition tags

This commit is contained in:
Paul Gauthier (aider) 2025-03-12 14:21:05 -07:00
parent 08a75808df
commit 865f71e2cc

View file

@ -3,7 +3,7 @@
; * modules and protocols ; * modules and protocols
(call (call
target: (identifier) @ignore target: (identifier) @ignore
(arguments (alias) @name) (arguments (alias) @name.definition.module)
(#any-of? @ignore "defmodule" "defprotocol")) @definition.module (#any-of? @ignore "defmodule" "defprotocol")) @definition.module
; * functions/macros ; * functions/macros
@ -12,12 +12,12 @@
(arguments (arguments
[ [
; zero-arity functions with no parentheses ; zero-arity functions with no parentheses
(identifier) @name (identifier) @name.definition.function
; regular function clause ; regular function clause
(call target: (identifier) @name) (call target: (identifier) @name.definition.function)
; function clause with a guard clause ; function clause with a guard clause
(binary_operator (binary_operator
left: (call target: (identifier) @name) left: (call target: (identifier) @name.definition.function)
operator: "when") operator: "when")
]) ])
(#any-of? @ignore "def" "defp" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp")) @definition.function (#any-of? @ignore "def" "defp" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp")) @definition.function
@ -39,16 +39,16 @@
(call (call
target: [ target: [
; local ; local
(identifier) @name (identifier) @name.reference.call
; remote ; remote
(dot (dot
right: (identifier) @name) right: (identifier) @name.reference.call)
]) @reference.call ]) @reference.call
; * pipe into function call ; * pipe into function call
(binary_operator (binary_operator
operator: "|>" operator: "|>"
right: (identifier) @name) @reference.call right: (identifier) @name.reference.call) @reference.call
; * modules ; * modules
(alias) @name @reference.module (alias) @name.reference.module @reference.module