queries: Add JSON injection for Rust json!({..}) macros

Note that this injection doesn't work currently because precedence is
not handled by the current syntax highlighter. The switch to tree-house
will properly handle the precedence of this pattern.
This commit is contained in:
Michael Davis 2025-03-12 17:40:08 -04:00
parent 694b61514f
commit 1bd7a3901c
No known key found for this signature in database

View file

@ -35,6 +35,18 @@
(#set! injection.language "rust")
(#set! injection.include-children))
((macro_invocation
macro:
[
(scoped_identifier name: (_) @_macro_name)
(identifier) @_macro_name
]
(token_tree
(token_tree . "{" "}" .) @injection.content))
(#eq? @_macro_name "json")
(#set! injection.language "json")
(#set! injection.include-children))
(call_expression
function: (scoped_identifier
path: (identifier) @_regex (#any-of? @_regex "Regex" "RegexBuilder")