diff options
author | Michael Davis | 2022-11-02 14:38:36 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-11-24 02:07:05 +0000 |
commit | 5a1bed2b708f6874daa9f04b26b14b3106d2e447 (patch) | |
tree | a3cb88f566be4093407b97ef5892f6f9434de290 /runtime/queries/erlang/locals.scm | |
parent | 452f7d071ceb57aad9da36473e6d2a0f0bedb462 (diff) |
Add parameter highlights to Erlang
This doesn't work robustly (within pattern matches). Only regular
bindings are highlighted as parameters. In order to highlight all
parameters even in matches, we would need an arbitrary nesting operator
in queries which doesn't exist yet in tree-sitter.
Diffstat (limited to 'runtime/queries/erlang/locals.scm')
-rw-r--r-- | runtime/queries/erlang/locals.scm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/runtime/queries/erlang/locals.scm b/runtime/queries/erlang/locals.scm new file mode 100644 index 00000000..7379926b --- /dev/null +++ b/runtime/queries/erlang/locals.scm @@ -0,0 +1,30 @@ +; Specs and Callbacks +(attribute + (stab_clause + pattern: (arguments (variable) @local.definition) + ; If a spec uses a variable as the return type (and later a `when` clause to type it): + body: (variable)? @local.definition)) @local.scope + +; parametric `-type`s +((attribute + name: (atom) @_type + (arguments + (binary_operator + left: (call (arguments (variable) @local.definition)) + operator: "::") @local.scope)) + (#match? @_type "(type|opaque)")) + +; macros +((attribute + name: (atom) @_define + (arguments + (call (arguments (variable) @local.definition)))) @local.scope + (#eq? @_define "define")) + +; `fun`s +(anonymous_function (stab_clause pattern: (arguments (variable) @local.definition))) @local.scope + +; Ordinary functions +(function_clause pattern: (arguments (variable) @local.definition)) @local.scope + +(variable) @local.reference |