mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-09-11 16:07:00 +03:00
add highlight scope for type parameters (#8660)
* rust: add highlight scope for type parameters * handle optional type parameters
This commit is contained in:
parent
ae6a0a9cfd
commit
70bbbd7d19
@ -155,6 +155,7 @@ #### Syntax highlighting
|
|||||||
|
|
||||||
- `type` - Types
|
- `type` - Types
|
||||||
- `builtin` - Primitive types provided by the language (`int`, `usize`)
|
- `builtin` - Primitive types provided by the language (`int`, `usize`)
|
||||||
|
- `parameter` - Generic type parameters (`T`)
|
||||||
- `enum`
|
- `enum`
|
||||||
- `variant`
|
- `variant`
|
||||||
- `constructor`
|
- `constructor`
|
||||||
|
@ -9,6 +9,13 @@
|
|||||||
; Types
|
; Types
|
||||||
; -------
|
; -------
|
||||||
|
|
||||||
|
(type_parameters
|
||||||
|
(type_identifier) @type.parameter)
|
||||||
|
(constrained_type_parameter
|
||||||
|
left: (type_identifier) @type.parameter)
|
||||||
|
(optional_type_parameter
|
||||||
|
name: (type_identifier) @type.parameter)
|
||||||
|
|
||||||
; ---
|
; ---
|
||||||
; Primitives
|
; Primitives
|
||||||
; ---
|
; ---
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
[
|
[
|
||||||
(function_item)
|
(function_item)
|
||||||
|
(struct_item)
|
||||||
|
(enum_item)
|
||||||
|
(union_item)
|
||||||
|
(type_item)
|
||||||
|
(trait_item)
|
||||||
|
(impl_item)
|
||||||
(closure_expression)
|
(closure_expression)
|
||||||
(block)
|
(block)
|
||||||
] @local.scope
|
] @local.scope
|
||||||
@ -11,8 +17,15 @@
|
|||||||
(parameter
|
(parameter
|
||||||
(identifier) @local.definition)
|
(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)
|
(closure_parameters (identifier) @local.definition)
|
||||||
|
|
||||||
; References
|
; References
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
(type_identifier) @local.reference
|
||||||
|
Loading…
Reference in New Issue
Block a user