aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/rust
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-02-13 09:31:51 +0000
committerBlaž Hrastnik2022-02-13 09:31:51 +0000
commitbd549d8a20cce98e24c8653a4a86107c786cbaa3 (patch)
tree0780b58d41b6181e69023265cdb54517e2953778 /runtime/queries/rust
parent7ad8eaaef0b292f4be6c66298cea40d2b928e172 (diff)
parent7083b98a388b30e0b61caac9bf6ccc1d79eadf81 (diff)
Merge remote-tracking branch 'origin/master' into debug
Diffstat (limited to 'runtime/queries/rust')
-rw-r--r--runtime/queries/rust/highlights.scm14
-rw-r--r--runtime/queries/rust/indents.toml1
-rw-r--r--runtime/queries/rust/injections.scm17
3 files changed, 27 insertions, 5 deletions
diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm
index 539d9550..26496c66 100644
--- a/runtime/queries/rust/highlights.scm
+++ b/runtime/queries/rust/highlights.scm
@@ -127,11 +127,16 @@
"await"
] @keyword.control
+"use" @keyword.control.import
+(mod_item "mod" @keyword.control.import !body)
+(use_as_clause "as" @keyword.control.import)
+
+(type_cast_expression "as" @keyword.operator)
+
[
(crate)
(super)
"as"
- "use"
"pub"
"mod"
"extern"
@@ -242,10 +247,9 @@
; ---
; Macros
; ---
-
(meta_item
- (identifier) @attribute)
-(attribute_item) @attribute
+ (identifier) @function.macro)
+
(inner_attribute_item) @attribute
(macro_definition
@@ -259,7 +263,7 @@
"!" @function.macro)
(metavariable) @variable.parameter
-(fragment_specifier) @variable.parameter
+(fragment_specifier) @type
diff --git a/runtime/queries/rust/indents.toml b/runtime/queries/rust/indents.toml
index 3900f0b9..51a0ceea 100644
--- a/runtime/queries/rust/indents.toml
+++ b/runtime/queries/rust/indents.toml
@@ -9,6 +9,7 @@ indent = [
"field_initializer_list",
"struct_pattern",
"tuple_pattern",
+ "unit_expression",
"enum_variant_list",
"call_expression",
"binary_expression",
diff --git a/runtime/queries/rust/injections.scm b/runtime/queries/rust/injections.scm
index 6035d418..77c70805 100644
--- a/runtime/queries/rust/injections.scm
+++ b/runtime/queries/rust/injections.scm
@@ -1,3 +1,6 @@
+([(line_comment) (block_comment)] @injection.content
+ (#set! injection.language "comment"))
+
((macro_invocation
(token_tree) @injection.content)
(#set! injection.language "rust")
@@ -7,3 +10,17 @@
(token_tree) @injection.content)
(#set! injection.language "rust")
(#set! injection.include-children))
+
+(call_expression
+ function: (scoped_identifier
+ path: (identifier) @_regex (#eq? @_regex "Regex")
+ name: (identifier) @_new (#eq? @_new "new"))
+ arguments: (arguments (raw_string_literal) @injection.content)
+ (#set! injection.language "regex"))
+
+(call_expression
+ function: (scoped_identifier
+ path: (scoped_identifier (identifier) @_regex (#eq? @_regex "Regex") .)
+ name: (identifier) @_new (#eq? @_new "new"))
+ arguments: (arguments (raw_string_literal) @injection.content)
+ (#set! injection.language "regex"))