aboutsummaryrefslogtreecommitdiffstats
path: root/queries/rust/highlights.scm
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2024-10-23 21:18:39 -0700
committerChristian Clason <ch.clason+github@icloud.com>2024-10-27 11:51:33 +0100
commit00d219068385a4aa80859d4606ad6e03af6faa83 (patch)
treebfe7ca5252f4e0ca9c37aef1f40e8ac1c4b08977 /queries/rust/highlights.scm
parentbot(lockfile): update javascript, mlir, templ, tlaplus (diff)
downloadnvim-treesitter-00d219068385a4aa80859d4606ad6e03af6faa83.tar
nvim-treesitter-00d219068385a4aa80859d4606ad6e03af6faa83.tar.gz
nvim-treesitter-00d219068385a4aa80859d4606ad6e03af6faa83.tar.bz2
nvim-treesitter-00d219068385a4aa80859d4606ad6e03af6faa83.tar.lz
nvim-treesitter-00d219068385a4aa80859d4606ad6e03af6faa83.tar.xz
nvim-treesitter-00d219068385a4aa80859d4606ad6e03af6faa83.tar.zst
nvim-treesitter-00d219068385a4aa80859d4606ad6e03af6faa83.zip
fix(rust): regex injections, highlights
**Problem:** Rust's regex injections were not applied since the string content is behind a `(string_content)` node, and the injections were applied to the parent node without the `include-children` directive. **Solution:** Apply the injections to the string content. Also highlight them accordingly.
Diffstat (limited to 'queries/rust/highlights.scm')
-rw-r--r--queries/rust/highlights.scm44
1 files changed, 44 insertions, 0 deletions
diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm
index c202206ca..f4d058efa 100644
--- a/queries/rust/highlights.scm
+++ b/queries/rust/highlights.scm
@@ -475,3 +475,47 @@
(block_comment
(doc_comment)) @comment.documentation
+
+(call_expression
+ function: (scoped_identifier
+ path: (identifier) @_regex
+ (#any-of? @_regex "Regex" "ByteRegexBuilder")
+ name: (identifier) @_new
+ (#eq? @_new "new"))
+ arguments: (arguments
+ (raw_string_literal
+ (string_content) @string.regexp)))
+
+(call_expression
+ function: (scoped_identifier
+ path: (scoped_identifier
+ (identifier) @_regex
+ (#any-of? @_regex "Regex" "ByteRegexBuilder") .)
+ name: (identifier) @_new
+ (#eq? @_new "new"))
+ arguments: (arguments
+ (raw_string_literal
+ (string_content) @string.regexp)))
+
+(call_expression
+ function: (scoped_identifier
+ path: (identifier) @_regex
+ (#any-of? @_regex "RegexSet" "RegexSetBuilder")
+ name: (identifier) @_new
+ (#eq? @_new "new"))
+ arguments: (arguments
+ (array_expression
+ (raw_string_literal
+ (string_content) @string.regexp))))
+
+(call_expression
+ function: (scoped_identifier
+ path: (scoped_identifier
+ (identifier) @_regex
+ (#any-of? @_regex "RegexSet" "RegexSetBuilder") .)
+ name: (identifier) @_new
+ (#eq? @_new "new"))
+ arguments: (arguments
+ (array_expression
+ (raw_string_literal
+ (string_content) @string.regexp))))