1([
2 (line_comment)
3 (block_comment)
4] @injection.content
5 (#set! injection.language "comment"))
6
7(macro_invocation
8 macro: [
9 (identifier) @_macro_name
10 (scoped_identifier
11 (identifier) @_macro_name .)
12 ]
13 (#not-any-of? @_macro_name "view" "html")
14 (token_tree) @injection.content
15 (#set! injection.language "rust"))
16
17; we need a better way for the leptos extension to declare that
18; it wants to inject inside of rust, instead of modifying the rust
19; injections to support leptos injections
20(macro_invocation
21 macro: [
22 (identifier) @_macro_name
23 (scoped_identifier
24 (identifier) @_macro_name .)
25 ]
26 (#any-of? @_macro_name "view" "html")
27 (token_tree) @injection.content
28 (#set! injection.language "rstml"))
29
30(macro_invocation
31 macro: [
32 (identifier) @_macro_name
33 (scoped_identifier
34 (identifier) @_macro_name .)
35 ]
36 (#any-of? @_macro_name "sql")
37 (_) @injection.content
38 (#set! injection.language "sql"))
39
40; lazy_regex
41(macro_invocation
42 macro: [
43 (identifier) @_macro_name
44 (scoped_identifier
45 (identifier) @_macro_name .)
46 ]
47 (token_tree
48 [
49 (string_literal
50 (string_content) @injection.content)
51 (raw_string_literal
52 (string_content) @injection.content)
53 ])
54 (#set! injection.language "regex")
55 (#any-of? @_macro_name "regex" "bytes_regex"))
56
57(call_expression
58 function: (scoped_identifier) @_fn_path
59 arguments: (arguments
60 [
61 (string_literal
62 (string_content) @injection.content)
63 (raw_string_literal
64 (string_content) @injection.content)
65 ])
66 (#match? @_fn_path ".*Regex(Builder)?::new")
67 (#set! injection.language "regex"))