mirror of https://github.com/helix-editor/helix
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.pull/13100/head
parent
694b61514f
commit
1bd7a3901c
|
@ -35,6 +35,18 @@
|
||||||
(#set! injection.language "rust")
|
(#set! injection.language "rust")
|
||||||
(#set! injection.include-children))
|
(#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
|
(call_expression
|
||||||
function: (scoped_identifier
|
function: (scoped_identifier
|
||||||
path: (identifier) @_regex (#any-of? @_regex "Regex" "RegexBuilder")
|
path: (identifier) @_regex (#any-of? @_regex "Regex" "RegexBuilder")
|
||||||
|
|
Loading…
Reference in New Issue