Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/rust/highlights.scm')
| -rw-r--r-- | runtime/queries/rust/highlights.scm | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index cc8380cb..981896f9 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -79,19 +79,18 @@ ; Types ; ------- -(type_parameter +(type_parameters + (type_identifier) @type.parameter) +(constrained_type_parameter + left: (type_identifier) @type.parameter) +(optional_type_parameter name: (type_identifier) @type.parameter) ((type_arguments (type_identifier) @constant) (#match? @constant "^[A-Z_]+$")) (type_arguments (type_identifier) @type) -; `_` in `(_, _)` (tuple_struct_pattern "_" @comment.unused) -; `_` in `Vec<_>` ((type_arguments (type_identifier) @comment.unused) (#eq? @comment.unused "_")) -; `_` in `Rc<[_]>` -((array_type (type_identifier) @comment.unused) - (#eq? @comment.unused "_")) ; --- ; Primitives @@ -112,7 +111,6 @@ ; Comments ; ------- -(shebang) @comment (line_comment) @comment.line (block_comment) @comment.block @@ -212,6 +210,10 @@ ; Keywords ; ------- +(for_expression + "for" @keyword.control.repeat) +(gen_block "gen" @keyword.control) + "in" @keyword.control [ @@ -240,6 +242,10 @@ (type_cast_expression "as" @keyword.operator) +((generic_type + type: (type_identifier) @keyword) + (#eq? @keyword "use")) + [ (crate) (super) @@ -257,10 +263,6 @@ "async" ] @keyword -(for_expression - "for" @keyword.control.repeat) -(gen_block "gen" @keyword.control) - [ "struct" "enum" @@ -303,23 +305,6 @@ ; Functions ; ------- -; highlight `baz` in `any_function(foo::bar::baz)` as function -; This generically works for an unlimited number of path segments: -; -; - `f(foo::bar)` -; - `f(foo::bar::baz)` -; - `f(foo::bar::baz::quux)` -; -; We know that in the above examples, the last component of each path is a function -; as the only other valid thing (following Rust naming conventions) would be a module at -; that position, however you cannot pass modules as arguments -(call_expression - function: _ - arguments: (arguments - (scoped_identifier - path: _ - name: (identifier) @function))) - (call_expression function: [ ((identifier) @function) |