fix(rust): inject html and json in macro

This commit is contained in:
ginnyTheCat 2025-03-08 18:36:31 +01:00
parent da89532f03
commit 05007ab7e4
No known key found for this signature in database
GPG key ID: 503E9FE62EB3A790

View file

@ -5,7 +5,7 @@
(identifier) @_macro_name
]
(token_tree) @injection.content
(#not-eq? @_macro_name "slint")
(#not-any-of? @_macro_name "slint" "html" "json")
(#set! injection.language "rust")
(#set! injection.include-children))
@ -21,6 +21,17 @@
(#set! injection.language "slint")
(#set! injection.include-children))
(macro_invocation
macro: [
(scoped_identifier
name: (_) @injection.language)
(identifier) @injection.language
]
(token_tree) @injection.content
(#any-of? @injection.language "html" "json")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children))
(macro_definition
(macro_rule
left: (token_tree_pattern) @injection.content
@ -37,11 +48,6 @@
] @injection.content
(#set! injection.language "comment"))
((macro_invocation
macro: (identifier) @injection.language
(token_tree) @injection.content)
(#any-of? @injection.language "html" "json"))
(call_expression
function: (scoped_identifier
path: (identifier) @_regex