elixir: Add textobjects queries (#22055)
Release Notes: - N/A Adds textobjects queries for Elixir. These queries were originally pulled directly from the [nvim-treesitter-textobjects](https://github.com/nvim-treesitter/nvim-treesitter-textobjects) repo with [this textobjects.scm](https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter-textobjects/refs/heads/master/queries/elixir/textobjects.scm) file, but have been heavily edited for Zed.
This commit is contained in:
parent
5f7de2eb5d
commit
e36ae0465c
1 changed files with 46 additions and 0 deletions
46
extensions/elixir/languages/elixir/textobjects.scm
Normal file
46
extensions/elixir/languages/elixir/textobjects.scm
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
(call
|
||||||
|
target: ((identifier) @_identifier
|
||||||
|
(#any-of? @_identifier "defmodule" "defprotocol" "defimpl"))
|
||||||
|
(do_block
|
||||||
|
"do"
|
||||||
|
(_)* @class.inside
|
||||||
|
"end")) @class.around
|
||||||
|
|
||||||
|
(anonymous_function
|
||||||
|
(stab_clause
|
||||||
|
right: (body) @function.inside)) @function.around
|
||||||
|
|
||||||
|
(call
|
||||||
|
target: ((identifier) @_identifier
|
||||||
|
(#any-of? @_identifier "def" "defmacro" "defmacrop" "defn" "defnp" "defp"))
|
||||||
|
(do_block
|
||||||
|
"do"
|
||||||
|
(_)* @function.inside
|
||||||
|
"end")) @function.around
|
||||||
|
|
||||||
|
(call
|
||||||
|
target: ((identifier) @_identifier
|
||||||
|
(#any-of? @_identifier "def" "defmacro" "defmacrop" "defn" "defnp" "defp"))
|
||||||
|
(arguments
|
||||||
|
(_)
|
||||||
|
(keywords
|
||||||
|
(pair
|
||||||
|
value: (_) @function.inside)))) @function.around
|
||||||
|
|
||||||
|
(call
|
||||||
|
target: ((identifier) @_identifier
|
||||||
|
(#any-of? @_identifier "defdelegate" "defguard" "defguardp"))) @function.around
|
||||||
|
|
||||||
|
(comment) @comment.around
|
||||||
|
|
||||||
|
(unary_operator
|
||||||
|
operator: "@"
|
||||||
|
operand: (call
|
||||||
|
target: ((identifier) @_identifier
|
||||||
|
(#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc"))
|
||||||
|
(arguments
|
||||||
|
[
|
||||||
|
(keywords) @comment.inside
|
||||||
|
(string
|
||||||
|
(quoted_content) @comment.inside)
|
||||||
|
]))) @comment.around
|
Loading…
Add table
Add a link
Reference in a new issue