Use standard injection.language and injection.content captures (#22268)
Closes #9656. Continuation of #9654, but with the addition of backwards compatibility for the existing captures. Release Notes: - Improved Tree-sitter support with added compatibility for standard injections captures --------- Co-authored-by: Finn Evers <finn.evers@outlook.de>
This commit is contained in:
parent
f3e75d8ff6
commit
d58f006498
21 changed files with 181 additions and 159 deletions
|
@ -2,6 +2,6 @@
|
|||
|
||||
((sigil
|
||||
(sigil_name) @_sigil_name
|
||||
(quoted_content) @content)
|
||||
(quoted_content) @injection.content)
|
||||
(#eq? @_sigil_name "H")
|
||||
(#set! language "heex"))
|
||||
(#set! injection.language "heex"))
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
(partial_expression_value)
|
||||
(expression_value)
|
||||
(ending_expression_value)
|
||||
] @content)
|
||||
(#set! language "elixir")
|
||||
(#set! combined)
|
||||
] @injection.content)
|
||||
(#set! injection.language "elixir")
|
||||
(#set! injection.combined)
|
||||
)
|
||||
|
||||
((expression (expression_value) @content)
|
||||
(#set! language "elixir"))
|
||||
((expression (expression_value) @injection.content)
|
||||
(#set! injection.language "elixir"))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(script_element
|
||||
(raw_text) @content
|
||||
(#set! "language" "javascript"))
|
||||
(raw_text) @injection.content
|
||||
(#set! injection.language "javascript"))
|
||||
|
||||
(style_element
|
||||
(raw_text) @content
|
||||
(#set! "language" "css"))
|
||||
(raw_text) @injection.content
|
||||
(#set! injection.language "css"))
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
((text) @content
|
||||
(#set! "language" "html")
|
||||
(#set! "combined"))
|
||||
((text) @injection.content
|
||||
(#set! injection.language "html")
|
||||
(#set! injection.combined))
|
||||
|
||||
((comment) @content
|
||||
(#match? @content "^/\\*\\*[^*]")
|
||||
(#set! "language" "phpdoc"))
|
||||
((comment) @injection.content
|
||||
(#match? @injection.content "^/\\*\\*[^*]")
|
||||
(#set! injection.language "phpdoc"))
|
||||
|
||||
((heredoc_body) (heredoc_end) @language) @content
|
||||
((heredoc_body) (heredoc_end) @injection.language) @injection.content
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/hcl/injections.scm
|
||||
|
||||
(heredoc_template
|
||||
(template_literal) @content
|
||||
(heredoc_identifier) @language
|
||||
(#downcase! @language))
|
||||
(template_literal) @injection.content
|
||||
(heredoc_identifier) @injection.language
|
||||
(#downcase! @injection.language))
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/hcl/injections.scm
|
||||
|
||||
(heredoc_template
|
||||
(template_literal) @content
|
||||
(heredoc_identifier) @language
|
||||
(#downcase! @language))
|
||||
(template_literal) @injection.content
|
||||
(heredoc_identifier) @injection.language
|
||||
(#downcase! @injection.language))
|
||||
|
||||
; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/terraform/injections.scm
|
||||
; inherits: hcl
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/hcl/injections.scm
|
||||
|
||||
(heredoc_template
|
||||
(template_literal) @content
|
||||
(heredoc_identifier) @language
|
||||
(#downcase! @language))
|
||||
(template_literal) @injection.content
|
||||
(heredoc_identifier) @injection.language
|
||||
(#downcase! @injection.language))
|
||||
|
||||
; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/terraform/injections.scm
|
||||
; inherits: hcl
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue