2023-07-06 21:42:51 -04:00
|
|
|
; References
|
2023-07-22 15:29:32 +02:00
|
|
|
(identifier) @local.reference
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2023-07-22 15:29:32 +02:00
|
|
|
((type_identifier) @local.reference
|
2023-07-06 21:42:51 -04:00
|
|
|
(#set! reference.kind "type"))
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2023-07-22 15:29:32 +02:00
|
|
|
((field_identifier) @local.reference
|
2023-07-06 21:42:51 -04:00
|
|
|
(#set! reference.kind "field"))
|
|
|
|
|
|
|
|
|
|
; Scopes
|
|
|
|
|
[
|
|
|
|
|
(program)
|
|
|
|
|
(block)
|
|
|
|
|
(function_definition)
|
|
|
|
|
(loop_expression)
|
|
|
|
|
(if_expression)
|
|
|
|
|
(match_expression)
|
|
|
|
|
(match_arm)
|
|
|
|
|
(struct_item)
|
|
|
|
|
(enum_item)
|
|
|
|
|
(impl_item)
|
2023-07-22 15:29:32 +02:00
|
|
|
] @local.scope
|
2023-07-06 21:42:51 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(use_declaration
|
2024-03-21 20:44:35 +09:00
|
|
|
argument: (scoped_identifier
|
|
|
|
|
name: (identifier) @local.definition.import))
|
2023-07-06 21:42:51 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(use_as_clause
|
2023-07-22 15:29:32 +02:00
|
|
|
alias: (identifier) @local.definition.import)
|
2023-07-06 21:42:51 -04:00
|
|
|
|
|
|
|
|
(use_list
|
2024-01-06 15:05:50 +09:00
|
|
|
(identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio};
|
2023-07-06 21:42:51 -04:00
|
|
|
|
|
|
|
|
; Functions
|
|
|
|
|
(function_definition
|
2024-01-06 15:05:50 +09:00
|
|
|
(identifier) @local.definition.function)
|
2023-07-06 21:42:51 -04:00
|
|
|
|
|
|
|
|
(function_definition
|
2023-07-22 15:29:32 +02:00
|
|
|
(identifier) @local.definition.method
|
2024-01-06 15:05:50 +09:00
|
|
|
(parameter
|
|
|
|
|
(self)))
|
2023-07-06 21:42:51 -04:00
|
|
|
|
|
|
|
|
; Function with parameters, defines parameters
|
|
|
|
|
(parameter
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
(identifier)
|
|
|
|
|
(self)
|
|
|
|
|
] @local.definition.parameter)
|
2023-07-06 21:42:51 -04:00
|
|
|
|
|
|
|
|
; Types
|
|
|
|
|
(struct_item
|
2023-07-22 15:29:32 +02:00
|
|
|
name: (type_identifier) @local.definition.type)
|
2023-07-06 21:42:51 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(constrained_type_parameter
|
2023-07-22 15:29:32 +02:00
|
|
|
left: (type_identifier) @local.definition.type) ; the P in remove_file<P: AsRef<Path>>(path: P)
|
2023-07-06 21:42:51 -04:00
|
|
|
|
|
|
|
|
(enum_item
|
2023-07-22 15:29:32 +02:00
|
|
|
name: (type_identifier) @local.definition.type)
|
2023-07-06 21:42:51 -04:00
|
|
|
|
|
|
|
|
; Module
|
2024-01-06 15:05:50 +09:00
|
|
|
(mod_item
|
2023-07-22 15:29:32 +02:00
|
|
|
name: (identifier) @local.definition.namespace)
|
2023-07-06 21:42:51 -04:00
|
|
|
|
|
|
|
|
; Variables
|
|
|
|
|
(assignment_expression
|
2024-01-06 15:05:50 +09:00
|
|
|
left: (identifier) @local.definition.var)
|