aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--book/src/themes.md1
-rw-r--r--runtime/queries/rust/highlights.scm7
-rw-r--r--runtime/queries/rust/locals.scm15
3 files changed, 22 insertions, 1 deletions
diff --git a/book/src/themes.md b/book/src/themes.md
index 66121076..a62c07fe 100644
--- a/book/src/themes.md
+++ b/book/src/themes.md
@@ -155,6 +155,7 @@ We use a similar set of scopes as
- `type` - Types
- `builtin` - Primitive types provided by the language (`int`, `usize`)
+ - `parameter` - Generic type parameters (`T`)
- `enum`
- `variant`
- `constructor`
diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm
index bf2fde49..47e57e80 100644
--- a/runtime/queries/rust/highlights.scm
+++ b/runtime/queries/rust/highlights.scm
@@ -9,6 +9,13 @@
; Types
; -------
+(type_parameters
+ (type_identifier) @type.parameter)
+(constrained_type_parameter
+ left: (type_identifier) @type.parameter)
+(optional_type_parameter
+ name: (type_identifier) @type.parameter)
+
; ---
; Primitives
; ---
diff --git a/runtime/queries/rust/locals.scm b/runtime/queries/rust/locals.scm
index 75e5d181..cb75d155 100644
--- a/runtime/queries/rust/locals.scm
+++ b/runtime/queries/rust/locals.scm
@@ -2,6 +2,12 @@
[
(function_item)
+ (struct_item)
+ (enum_item)
+ (union_item)
+ (type_item)
+ (trait_item)
+ (impl_item)
(closure_expression)
(block)
] @local.scope
@@ -11,8 +17,15 @@
(parameter
(identifier) @local.definition)
+(type_parameters
+ (type_identifier) @local.definition)
+(constrained_type_parameter
+ left: (type_identifier) @local.definition)
+(optional_type_parameter
+ name: (type_identifier) @local.definition)
+
(closure_parameters (identifier) @local.definition)
; References
(identifier) @local.reference
-
+(type_identifier) @local.reference