mirror of
https://github.com/helix-editor/helix.git
synced 2025-04-02 02:17:44 +03:00
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:
parent
694b61514f
commit
1bd7a3901c
1 changed files with 12 additions and 0 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue