nvim-treesitter/queries/hare/locals.scm
Christian Clason 99ddf57353
feat(highlights)!: enforce documented captures (#6232)
Problem: Allowing undocumented "secret" (sub)captures makes it harder
to write comprehensive colorschemes and catch inconsistent captures.

Solution: Only allow captures listed in CONTRIBUTING.md. Add useful
(cross-language) subcaptures and drop language-specific or too niche
ones.

Follow-up: Adding further `*.builtin` captures and changing queries to
use them.

Language-specific subcaptures should instead be added in user config or
a custom language plugin.
2024-03-03 11:00:11 +01:00

65 lines
882 B
Scheme

; Scopes
[
(module)
(function_declaration)
(if_statement)
(for_statement)
(match_expression)
(switch_expression)
] @local.scope
; References
[
(identifier)
(scoped_type_identifier)
] @local.reference
; Definitions
(global_binding
(identifier) @local.definition.constant
.
":"
(_))
(const_declaration
"const"
(identifier) @local.definition.constant
.
"=")
(field
.
(identifier) @local.definition.field)
(field_assignment
.
(identifier) @local.definition.field)
(function_declaration
"fn"
.
(identifier) @local.definition.function)
(parameter
(_) @local.definition.parameter
.
":")
(type_declaration
"type"
(identifier) @local.definition.type
.
"=")
(type_declaration
"type"
(identifier) @local.definition.enum
.
"="
(enum_type))
(let_declaration
"let"
.
(identifier) @local.definition.var
","?)