nvim-treesitter/queries/ebnf/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

42 lines
571 B
Scheme

; Simple tokens ;;;;
(terminal) @string
(special_sequence) @string.special
(integer) @number
(comment) @comment @spell
; Identifiers ;;;;
; Allow different highlighting for specific casings
((identifier) @type
(#lua-match? @type "^%u"))
((identifier) @string.special.symbol
(#lua-match? @string.special.symbol "^%l"))
((identifier) @constant
(#lua-match? @constant "^%u[%u%d_]+$"))
; Punctuation ;;;;
[
";"
","
] @punctuation.delimiter
[
"|"
"*"
"-"
] @operator
"=" @keyword.operator
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket