fix(rust): inject html and json in macro invocations (#7715)

This commit is contained in:
ginnyTheCat 2025-03-08 18:49:06 +01:00 committed by GitHub
parent ee8e149a4f
commit f0c17dc859
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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