aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorClay2022-09-05 13:49:41 +0000
committerGitHub2022-09-05 13:49:41 +0000
commitda8071047a8d48cb93dfb4a6ab9b8b2d08efb0dd (patch)
tree9cc638f85d1b30b6940cb86cd5e53400db25d20a /runtime
parentdf1ed0a5fd02cc89ccfa3bf0912848249bebae6d (diff)
Elixir: update tree-sitter queries (#3645)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/queries/elixir/injections.scm50
-rw-r--r--runtime/queries/elixir/textobjects.scm2
2 files changed, 43 insertions, 9 deletions
diff --git a/runtime/queries/elixir/injections.scm b/runtime/queries/elixir/injections.scm
index 5c58a863..4853b84b 100644
--- a/runtime/queries/elixir/injections.scm
+++ b/runtime/queries/elixir/injections.scm
@@ -1,20 +1,16 @@
+; Elixir Code Comments
((comment) @injection.content
(#set! injection.language "comment"))
+; Elixir Regular Expressions
((sigil
(sigil_name) @_sigil_name
(quoted_content) @injection.content)
- (#match? @_sigil_name "^(r|R)$")
+ (#match? @_sigil_name "^(R|r)$")
(#set! injection.language "regex")
(#set! injection.combined))
-((sigil
- (sigil_name) @_sigil_name
- (quoted_content) @injection.content)
- (#eq? @_sigil_name "H")
- (#set! injection.language "heex")
- (#set! injection.combined))
-
+; Elixir Markdown Documentation
(unary_operator
operator: "@"
operand: (call
@@ -23,3 +19,41 @@
(string (quoted_content) @injection.content)
(sigil (quoted_content) @injection.content)
])) (#set! injection.language "markdown"))
+
+; Zigler Sigils
+((sigil
+ (sigil_name) @_sigil_name
+ (quoted_content) @injection.content)
+ (#match? @_sigil_name "^(Z|z)$")
+ (#set! injection.language "zig")
+ (#set! injection.combined))
+
+; Jason Sigils
+((sigil
+ (sigil_name) @_sigil_name
+ (quoted_content) @injection.content)
+ (#match? @_sigil_name "^(J|j)$")
+ (#set! injection.language "json")
+ (#set! injection.combined))
+
+; Phoenix Live View HEEx Sigils
+((sigil
+ (sigil_name) @_sigil_name
+ (quoted_content) @injection.content)
+ (#eq? @_sigil_name "H")
+ (#set! injection.language "heex")
+ (#set! injection.combined))
+
+; Phoenix Live View Component Macros
+(call
+ (identifier) @_identifier
+ (arguments
+ (atom)+
+ (keywords (pair
+ ((keyword) @_keyword (#eq? @_keyword "doc: "))
+ [
+ (string (quoted_content) @injection.content)
+ (sigil (quoted_content) @injection.content)
+ ]))
+ (#match? @_identifier "^(attr|slot)$")
+ (#set! injection.language "markdown")))
diff --git a/runtime/queries/elixir/textobjects.scm b/runtime/queries/elixir/textobjects.scm
index cc1bee99..ab456584 100644
--- a/runtime/queries/elixir/textobjects.scm
+++ b/runtime/queries/elixir/textobjects.scm
@@ -32,4 +32,4 @@
(do_block (_)* @test.inside)?)
(#match? @_keyword "^(test|describe)$")) @test.around
-(comment) @comment.around @comment.inside
+(comment)+ @comment.around @comment.inside