Skip to content

Commit

Permalink
elixir: inject zig, json into sigils
Browse files Browse the repository at this point in the history
  • Loading branch information
connorlay committed Sep 3, 2022
1 parent 20a7aaf commit 14786e6
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions runtime/queries/elixir/injections.scm
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
; Elixir Comments
; 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))

; Elixir Documentation
; Elixir Markdown Documentation
(unary_operator
operator: "@"
operand: (call
Expand All @@ -20,6 +20,22 @@
(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
Expand All @@ -34,7 +50,7 @@
(arguments
(atom)+
(keywords (pair
(keyword)
((keyword) @_keyword (#eq? @_keyword "doc: "))
[
(string (quoted_content) @injection.content)
(sigil (quoted_content) @injection.content)
Expand Down

0 comments on commit 14786e6

Please sign in to comment.