
Fixes #16199 ## Description Recently added template string injections do not completely work for because any time there is an interpolation (`${// some js content}`) within an element, its closing tag is not highlighted properly:  This PR fixes the issue:  Release Notes: - Fixed incomplete syntax highlighting for HTML injections inside JavaScript template tags. ## Note I'm a beginner with treesitter so I only modified the part for HTML usecase. Should the same solution be applied to other injections (`css`, `js`, etc.)?
49 lines
1.4 KiB
Scheme
49 lines
1.4 KiB
Scheme
(((comment) @_jsdoc_comment
|
|
(#match? @_jsdoc_comment "(?s)^/[*][*][^*].*[*]/$")) @content
|
|
(#set! "language" "jsdoc"))
|
|
|
|
((regex) @content
|
|
(#set! "language" "regex"))
|
|
|
|
(call_expression
|
|
function: (identifier) @_name (#eq? @_name "css")
|
|
arguments: (template_string (string_fragment) @content
|
|
(#set! "language" "css"))
|
|
)
|
|
|
|
(call_expression
|
|
function: (identifier) @_name (#eq? @_name "html")
|
|
arguments: (template_string) @content
|
|
(#set! "language" "html")
|
|
)
|
|
|
|
(call_expression
|
|
function: (identifier) @_name (#eq? @_name "js")
|
|
arguments: (template_string (string_fragment) @content
|
|
(#set! "language" "javascript"))
|
|
)
|
|
|
|
(call_expression
|
|
function: (identifier) @_name (#eq? @_name "json")
|
|
arguments: (template_string (string_fragment) @content
|
|
(#set! "language" "json"))
|
|
)
|
|
|
|
(call_expression
|
|
function: (identifier) @_name (#eq? @_name "sql")
|
|
arguments: (template_string (string_fragment) @content
|
|
(#set! "language" "sql"))
|
|
)
|
|
|
|
(call_expression
|
|
function: (identifier) @_name (#eq? @_name "ts")
|
|
arguments: (template_string (string_fragment) @content
|
|
(#set! "language" "typescript"))
|
|
)
|
|
|
|
(call_expression
|
|
function: (identifier) @_name (#match? @_name "^ya?ml$")
|
|
arguments: (template_string (string_fragment) @content
|
|
(#set! "language" "yaml"))
|
|
)
|
|
|