syntax roles
a syntax role is what a piece of code is (a function, a keyword, a comment, a json key) and the color and style it gets. neovim, zed and vs code share one table of roles, SYNTAX in tools/build.py, so a function is blue in all three. this is that table, read from the script when the site is built.
| role | color | style | note |
|---|---|---|---|
comment | comment | italic | |
comment.tag | muted | italic | tags inside doc comments, such as @param |
string | green | ||
string.documentation | green | ||
string.escape | cyan | ||
string.regexp | cyan | ||
string.special | cyan | ||
string.special.symbol | pink | ||
number | pink | ||
boolean | pink | ||
constant | pink | also enum members | |
constant.builtin | cyan | null, undefined | |
variable | fg | ||
variable.builtin | cyan | self, this | |
variable.parameter | fg | ||
variable.member | fg | fields and property access | |
property | red | keys in key/value data such as JSON, YAML and CSS | |
function | blue | ||
function.builtin | cyan | ||
function.macro | cyan | ||
constructor | cyan | ||
attribute | cyan | decorators and annotations | |
type | yellow | ||
type.builtin | cyan | ||
module | yellow | ||
lifetime | pink | italic | |
label | yellow | ||
keyword | violet | ||
keyword.conditional | red | bold | |
keyword.repeat | yellow | ||
keyword.return | red | ||
keyword.exception | red | ||
keyword.import | violet | ||
keyword.modifier | violet | ||
keyword.directive | yellow | preprocessor | |
operator | muted | ||
punctuation | steel | ||
punctuation.special | cyan | string interpolation brackets | |
tag | red | ||
tag.attribute | yellow | ||
selector | yellow | ||
selector.pseudo | violet | ||
markup.heading | blue | bold | |
markup.strong | text | bold | |
markup.italic | text | italic | |
markup.strikethrough | text | strikethrough | |
markup.quote | muted | italic | |
markup.list | red | ||
markup.raw | green | ||
markup.link.label | cyan | ||
markup.link.url | blue | underline | |
diff.plus | green | ||
diff.minus | red | ||
diff.delta | blue | ||
diff.range | violet | ||
deprecated | text | strikethrough |
keywords
rime splits keywords by kind instead of painting them one color: declarations are violet, loops yellow, conditionals bold rose, and returns and exceptions rose. the neovim page shows how to make them one color again.
where the editors differ
- role names follow neovim's treesitter captures. each port maps its own scope names onto them.
- zed puts
if,for,returnandtryinto onekeyword.controlcapture, so those share the rose color. - in vs code, typescript and javascript give
return,awaitandyieldthe same scope, so all three are rose. - neovim's
stylesoption restyles a group of roles at once, so every role in a group carries the group's default style.