Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

elixir: Add textobjects queries (#22055)

David Baldwine36ae0465c53
diff --git a/extensions/elixir/languages/elixir/textobjects.scm b/extensions/elixir/languages/elixir/textobjects.scm
new file mode 100644
index 00000000000..da111a11659
--- /dev/null
+++ b/extensions/elixir/languages/elixir/textobjects.scm
@@ -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