diff options
| author | Pham Huy Hoang <hoangtun0810@gmail.com> | 2024-01-05 03:19:54 +0900 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2024-01-19 16:58:37 +0100 |
| commit | edee83272efe9b597bc27e8060539cdffa3b12a8 (patch) | |
| tree | 0ee5a346d619b55c932eb87f0a4578d03d4f0116 /queries/elixir | |
| parent | feat: query formatting script (diff) | |
| download | nvim-treesitter-edee83272efe9b597bc27e8060539cdffa3b12a8.tar nvim-treesitter-edee83272efe9b597bc27e8060539cdffa3b12a8.tar.gz nvim-treesitter-edee83272efe9b597bc27e8060539cdffa3b12a8.tar.bz2 nvim-treesitter-edee83272efe9b597bc27e8060539cdffa3b12a8.tar.lz nvim-treesitter-edee83272efe9b597bc27e8060539cdffa3b12a8.tar.xz nvim-treesitter-edee83272efe9b597bc27e8060539cdffa3b12a8.tar.zst nvim-treesitter-edee83272efe9b597bc27e8060539cdffa3b12a8.zip | |
refactor: manual pre-cleanup
Moving comments, adding `format-ignore` to lines that will be better
with it
Diffstat (limited to 'queries/elixir')
| -rw-r--r-- | queries/elixir/locals.scm | 241 |
1 files changed, 137 insertions, 104 deletions
diff --git a/queries/elixir/locals.scm b/queries/elixir/locals.scm index ae37b9ca8..59e55eae0 100644 --- a/queries/elixir/locals.scm +++ b/queries/elixir/locals.scm @@ -1,41 +1,21 @@ ; References (identifier) @local.reference + (alias) @local.reference ; Module Definitions (call - target: ((identifier) @_identifier (#eq? @_identifier "defmodule")) - (arguments (alias) @local.definition.type)) + target: + ((identifier) @_identifier + (#eq? @_identifier "defmodule")) + (arguments + (alias) @local.definition.type)) ; Pattern Match Definitions -(binary_operator left: [ - (identifier) @local.definition.var - (_ (identifier) @local.definition.var) - (_ (_ (identifier) @local.definition.var)) - (_ (_ (_ (identifier) @local.definition.var))) - (_ (_ (_ (_ (identifier) @local.definition.var)))) - (_ (_ (_ (_ (_ (identifier) @local.definition.var))))) - (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))) -] operator: "=") - -; Stab Clause Definitions -(stab_clause - left: [ - (arguments [ +(binary_operator + ; format-ignore + left: + [ (identifier) @local.definition.var (_ (identifier) @local.definition.var) (_ (_ (identifier) @local.definition.var)) @@ -57,9 +37,15 @@ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))) (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))) (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))) - ]) - (binary_operator - left: (arguments [ + ] + operator: "=") +; Stab Clause Definitions +; format-ignore +(stab_clause + left: + [ + (arguments + [ (identifier) @local.definition.var (_ (identifier) @local.definition.var) (_ (_ (identifier) @local.definition.var)) @@ -81,84 +67,131 @@ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))) (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))) (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))) - ]) operator: "when") -]) + ]) + (binary_operator + left: + (arguments + ; format-ignore + [ + (identifier) @local.definition.var + (_ (identifier) @local.definition.var) + (_ (_ (identifier) @local.definition.var)) + (_ (_ (_ (identifier) @local.definition.var))) + (_ (_ (_ (_ (identifier) @local.definition.var)))) + (_ (_ (_ (_ (_ (identifier) @local.definition.var))))) + (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))) + ]) + operator: "when") + ]) ; Aliases +; format-ignore (call - target: ((identifier) @_identifier (#any-of? @_identifier "require" "alias" "use" "import")) - (arguments [ - (alias) @local.definition.import - (_ (alias) @local.definition.import) - (_ (_ (alias) @local.definition.import)) - (_ (_ (_ (alias) @local.definition.import))) - (_ (_ (_ (_ (alias) @local.definition.import)))) - ] -)) + target: + ((identifier) @_identifier + (#any-of? @_identifier "require" "alias" "use" "import")) + (arguments + [ + (alias) @local.definition.import + (_ (alias) @local.definition.import) + (_ (_ (alias) @local.definition.import)) + (_ (_ (_ (alias) @local.definition.import))) + (_ (_ (_ (_ (alias) @local.definition.import)))) + ])) ; Local Function Definitions & Scopes +; format-ignore (call - target: ((identifier) @_identifier (#any-of? @_identifier "def" "defp" "defmacro" "defmacrop" "defguard" "defguardp" "defn" "defnp" "for")) - (arguments [ - (identifier) @local.definition.function - (binary_operator left: (identifier) @local.definition.function operator: "when") - (binary_operator (identifier) @local.definition.parameter) - (call target: (identifier) @local.definition.function (arguments [ - (identifier) @local.definition.parameter - (_ (identifier) @local.definition.parameter) - (_ (_ (identifier) @local.definition.parameter)) - (_ (_ (_ (identifier) @local.definition.parameter))) - (_ (_ (_ (_ (identifier) @local.definition.parameter)))) - (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))) - (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))))) - ])) - ]?) (#set! definition.function.scope parent) - (do_block)? -) @local.scope - + target: + ((identifier) @_identifier + (#any-of? @_identifier "def" "defp" "defmacro" "defmacrop" "defguard" "defguardp" "defn" "defnp" "for")) + (arguments + [ + (identifier) @local.definition.function + (binary_operator + left: (identifier) @local.definition.function + operator: "when") + (binary_operator + (identifier) @local.definition.parameter) + (call + target: (identifier) @local.definition.function + (arguments + [ + (identifier) @local.definition.parameter + (_ (identifier) @local.definition.parameter) + (_ (_ (identifier) @local.definition.parameter)) + (_ (_ (_ (identifier) @local.definition.parameter))) + (_ (_ (_ (_ (identifier) @local.definition.parameter)))) + (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))) + (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))))) + ])) + ]?) + (#set! definition.function.scope parent)(do_block)?) @local.scope ; ExUnit Test Definitions & Scopes +; format-ignore (call - target: ((identifier) @_identifier (#eq? @_identifier "test")) - (arguments [ - (string) - ((string) . "," . [ - (identifier) @local.definition.parameter - (_ (identifier) @local.definition.parameter) - (_ (_ (identifier) @local.definition.parameter)) - (_ (_ (_ (identifier) @local.definition.parameter))) - (_ (_ (_ (_ (identifier) @local.definition.parameter)))) - (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))) - (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))))) - ]) -]) (do_block)?) @local.scope - + target: + ((identifier) @_identifier + (#eq? @_identifier "test")) + (arguments + [ + (string) + ((string) + . + "," + . + [ + (identifier) @local.definition.parameter + (_ (identifier) @local.definition.parameter) + (_ (_ (identifier) @local.definition.parameter)) + (_ (_ (_ (identifier) @local.definition.parameter))) + (_ (_ (_ (_ (identifier) @local.definition.parameter)))) + (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))) + (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))))) + ]) + ]) + (do_block)?) @local.scope ; Stab Clause Scopes (stab_clause) @local.scope |
