Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elixir: Add textobjects queries #22055

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions extensions/elixir/languages/elixir/textobjects.scm
Original file line number Diff line number Diff line change
@@ -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