Elixir: update tree-sitter queries (#3645)

pull/3708/head
Clay 2 years ago committed by GitHub
parent df1ed0a5fd
commit da8071047a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,13 +1,42 @@
; Elixir Code Comments
((comment) @injection.content ((comment) @injection.content
(#set! injection.language "comment")) (#set! injection.language "comment"))
; Elixir Regular Expressions
((sigil ((sigil
(sigil_name) @_sigil_name (sigil_name) @_sigil_name
(quoted_content) @injection.content) (quoted_content) @injection.content)
(#match? @_sigil_name "^(r|R)$") (#match? @_sigil_name "^(R|r)$")
(#set! injection.language "regex") (#set! injection.language "regex")
(#set! injection.combined)) (#set! injection.combined))
; Elixir Markdown Documentation
(unary_operator
operator: "@"
operand: (call
target: ((identifier) @_identifier (#match? @_identifier "^(module|type|short)?doc$"))
(arguments [
(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
(sigil_name) @_sigil_name (sigil_name) @_sigil_name
(quoted_content) @injection.content) (quoted_content) @injection.content)
@ -15,11 +44,16 @@
(#set! injection.language "heex") (#set! injection.language "heex")
(#set! injection.combined)) (#set! injection.combined))
(unary_operator ; Phoenix Live View Component Macros
operator: "@" (call
operand: (call (identifier) @_identifier
target: ((identifier) @_identifier (#match? @_identifier "^(module|type|short)?doc$")) (arguments
(arguments [ (atom)+
(keywords (pair
((keyword) @_keyword (#eq? @_keyword "doc: "))
[
(string (quoted_content) @injection.content) (string (quoted_content) @injection.content)
(sigil (quoted_content) @injection.content) (sigil (quoted_content) @injection.content)
])) (#set! injection.language "markdown")) ]))
(#match? @_identifier "^(attr|slot)$")
(#set! injection.language "markdown")))

@ -32,4 +32,4 @@
(do_block (_)* @test.inside)?) (do_block (_)* @test.inside)?)
(#match? @_keyword "^(test|describe)$")) @test.around (#match? @_keyword "^(test|describe)$")) @test.around
(comment) @comment.around @comment.inside (comment)+ @comment.around @comment.inside

Loading…
Cancel
Save