nvim-treesitter/queries/rbs/highlights.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

134 lines
1.5 KiB
Scheme

; Use directive
(use_clause
[
(type_name)
(simple_type_name)
] @type)
; Builtin constants and Keywords
[
"true"
"false"
] @boolean
"nil" @constant.builtin
[
"use"
"as"
"class"
"module"
"interface"
"type"
"def"
"attr_reader"
"attr_writer"
"attr_accessor"
"end"
"alias"
] @keyword
"def" @keyword.function
; Members of declaration
[
"include"
"extend"
"prepend"
] @function.method
(visibility) @type.qualifier
(comment) @comment @spell
(method_member
(method_name
[
(identifier)
(constant)
(operator)
(setter)
] @function.method))
[
(ivar_name)
(cvar_name)
] @variable.member
(alias_member
(method_name) @function)
(class_name
(constant) @type)
(module_name
(constant) @type)
(interface_name
(interface) @type)
(alias_name
(identifier) @type)
(type_variable) @constant
(namespace
(constant) @module)
(builtin_type) @type.builtin
(const_name
(constant) @constant)
(global_name) @variable
; Standard Arguments
(parameter
(var_name) @variable.parameter)
; Keyword Arguments
(keyword) @variable.parameter
; Self
(self) @variable.builtin
; Literal
(type
(symbol_literal) @string.special.symbol)
(type
(string_literal
(escape_sequence) @string.escape))
(type
(string_literal) @string)
(type
(integer_literal) @number)
; Operators
[
"="
"->"
"<"
"**"
"*"
"&"
"|"
"^"
] @operator
; Punctuation
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
[
","
"."
] @punctuation.delimiter