diff --git a/queries/rust/injections.scm b/queries/rust/injections.scm index d8aa98245..08974c00e 100644 --- a/queries/rust/injections.scm +++ b/queries/rust/injections.scm @@ -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