From 05007ab7e4229078835138e7d3d904b0d119e159 Mon Sep 17 00:00:00 2001 From: ginnyTheCat Date: Sat, 8 Mar 2025 18:36:31 +0100 Subject: [PATCH] fix(rust): inject html and json in macro --- queries/rust/injections.scm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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