fix(julia): fix injection queries

This patch fixes the julia `(string_literal)` injection queries after
the breaking changes in
https://github.com/tree-sitter/tree-sitter-julia/pull/153. The queries
are simplified by the fact that string content is now directly available
as a separate `(content)` child node.
This commit is contained in:
Fredrik Ekre 2024-11-22 13:09:12 +01:00 committed by Christian Clason
parent 2d5c122af9
commit 2d816bb49e

View file

@ -1,5 +1,6 @@
; Inject markdown in docstrings ; Inject markdown in docstrings
((string_literal) @injection.content ((string_literal
(content) @injection.content)
. .
[ [
(module_definition) (module_definition)
@ -10,9 +11,7 @@
(assignment) (assignment)
(const_statement) (const_statement)
] ]
(#lua-match? @injection.content "^\"\"\"") (#set! injection.language "markdown"))
(#set! injection.language "markdown")
(#offset! @injection.content 0 3 0 -3))
; Inject comments ; Inject comments
([ ([
@ -21,20 +20,21 @@
] @injection.content ] @injection.content
(#set! injection.language "comment")) (#set! injection.language "comment"))
; Inject regex in r"hello\bworld" ; Inject regex in r"..." and r"""...""" (e.g. r"hello\bworld")
((prefixed_string_literal (prefixed_string_literal
prefix: (identifier) @_prefix) @injection.content prefix: (identifier) @_prefix
(content) @injection.content
(#eq? @_prefix "r") (#eq? @_prefix "r")
(#set! injection.language "regex") (#set! injection.language "regex"))
(#offset! @injection.content 0 2 0 -1))
; Inject markdown in md"**Bold** and _Italics_" ; Inject markdown in md"..." and md"""...""" (e.g. md"**Bold** and _Italics_")
((prefixed_string_literal (prefixed_string_literal
prefix: (identifier) @_prefix) @injection.content prefix: (identifier) @_prefix
(content) @injection.content
(#eq? @_prefix "md") (#eq? @_prefix "md")
(#set! injection.language "markdown") (#set! injection.language "markdown"))
(#offset! @injection.content 0 3 0 -1))
; Inject bash in `git add --help` ; Inject bash in `...` and ```...``` (e.g. `git add --help`)
((command_literal) @injection.content (command_literal
(content) @injection.content
(#set! injection.language "bash")) (#set! injection.language "bash"))