Files
helix/runtime/queries/erlang/locals.scm
Michael Davis 14eda106f0 queries: Discard Erlang locals for macro names
Macro names might match recursively within a pattern (in the future).
They're not parameters / locals at all, so we can override the capture
from the previous pattern to avoid ever highlighting them as parameters.
2026-06-12 15:06:53 -04:00

27 lines
918 B
Scheme

; Specs and Callbacks
(attribute
(stab_clause
pattern: (arguments (variable)? @local.definition.variable.parameter)
; If a spec uses a variable as the return type (and later a `when` clause to type it):
body: (variable)? @local.definition.variable.parameter)) @local.scope
; parametric `-type`s
((attribute
name: (atom) @_keyword
(arguments
(binary_operator
left: (call (arguments (variable) @local.definition.variable.parameter))
operator: "::") @local.scope))
(#any-of? @_keyword "type" "opaque" "nominal"))
; `fun`s
(anonymous_function (stab_clause pattern: (arguments (variable) @local.definition.variable.parameter))) @local.scope
; Ordinary functions
((function_clause
pattern: (arguments (variable) @local.definition.variable.parameter)) @local.scope
(#not-match? @local.definition.variable.parameter "^_"))
(variable) @local.reference
(macro (variable)) @_