Files
helix/runtime/queries/rust/locals.scm
Michael Davis e0dd20d729 queries: Use discards instead of highlight captures in locals.scm
With tree-house v0.4, locals now correctly have their own precedence and
act independently. This removes the need to hack around the precedence
of highlights versus locals as we were doing. So this change mainly
updates captures which were highlights to be discards instead.
2026-05-31 12:02:14 -04:00

65 lines
1.3 KiB
Scheme

; Scopes
[
(function_item)
(struct_item)
(enum_item)
(union_item)
(type_item)
(trait_item)
(impl_item)
(closure_expression)
(block)
] @local.scope
; Definitions
(function_item
(parameters
(parameter
pattern: (identifier) @local.definition.variable.parameter)))
(closure_parameters (identifier) @local.definition.variable.parameter)
; Mutable variables
(let_declaration
(mutable_specifier)
pattern: (identifier) @local.definition.variable.mutable)
(mut_pattern
(mutable_specifier)
(identifier) @local.definition.variable.mutable)
(parameter
(mutable_specifier)
pattern: (identifier) @local.definition.variable.parameter.mutable)
(self_parameter
(mutable_specifier)
(self) @local.definition.variable.builtin.mutable)
; References
(self) @local.reference
(identifier) @local.reference
; lifetimes / labels
(lifetime (identifier) @_)
(label (identifier) @_)
; == scoped function calls and function defs ==
; avoid coloring functions as variables
(call_expression
function: (scoped_identifier
name: (identifier) @_))
(generic_function
function: (scoped_identifier
name: (identifier) @_))
(function_item
name: (identifier) @_)
(function_signature_item
name: (identifier) @_)
; == other ==
(enum_variant (identifier) @_)