nvim-treesitter/queries/julia/injections.scm
Fredrik Ekre 2d816bb49e 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.
2024-11-22 13:33:54 +01:00

40 lines
1,005 B
Scheme

; Inject markdown in docstrings
((string_literal
(content) @injection.content)
.
[
(module_definition)
(abstract_definition)
(struct_definition)
(function_definition)
(macro_definition)
(assignment)
(const_statement)
]
(#set! injection.language "markdown"))
; Inject comments
([
(line_comment)
(block_comment)
] @injection.content
(#set! injection.language "comment"))
; Inject regex in r"..." and r"""...""" (e.g. r"hello\bworld")
(prefixed_string_literal
prefix: (identifier) @_prefix
(content) @injection.content
(#eq? @_prefix "r")
(#set! injection.language "regex"))
; Inject markdown in md"..." and md"""...""" (e.g. md"**Bold** and _Italics_")
(prefixed_string_literal
prefix: (identifier) @_prefix
(content) @injection.content
(#eq? @_prefix "md")
(#set! injection.language "markdown"))
; Inject bash in `...` and ```...``` (e.g. `git add --help`)
(command_literal
(content) @injection.content
(#set! injection.language "bash"))