File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 24
24
name: (identifier) @_new (#eq? @_new " new" ))
25
25
arguments: (arguments (raw_string_literal) @injection.content)
26
26
(#set! injection.language " regex" ))
27
+
28
+ ; Highlight SQL in `sqlx::query!()`
29
+ (macro_invocation
30
+ macro: (scoped_identifier
31
+ path: (identifier) @_sqlx (#eq? @_sqlx " sqlx" )
32
+ name: (identifier) @_query (#eq? @_query " query" ))
33
+ (token_tree
34
+ ; Only the first argument is SQL
35
+ .
36
+ [(string_literal) (raw_string_literal)] @injection.content
37
+ )
38
+ (#set! injection.language " sql" ))
39
+
40
+ ; Highlight SQL in `sqlx::query_as!()`
41
+ (macro_invocation
42
+ macro: (scoped_identifier
43
+ path: (identifier) @_sqlx (#eq? @_sqlx " sqlx" )
44
+ name: (identifier) @_query_as (#eq? @_query_as " query_as" ))
45
+ (token_tree
46
+ ; Only the second argument is SQL
47
+ .
48
+ ; Allow anything as the first argument in case the user has lower case type
49
+ ; names for some reason
50
+ (_)
51
+ [(string_literal) (raw_string_literal)] @injection.content
52
+ )
53
+ (#set! injection.language " sql" ))
You can’t perform that action at this time.
0 commit comments