Skip to content

Colour from what the compiler concluded - #926

Merged
onatozmenn merged 4 commits into
mainfrom
lsp-semantic-tokens
Aug 5, 2026
Merged

Colour from what the compiler concluded#926
onatozmenn merged 4 commits into
mainfrom
lsp-semantic-tokens

Conversation

@onatozmenn

Copy link
Copy Markdown
Collaborator

textDocument/semanticTokens/full, the last thing on the advertised list this server did not answer and the one an editor cannot do for itself.

The keyword/name split is the lexer's own. What a name stands for is the resolver's: function, type, enum member, parameter, or variable for a name nothing resolved.

Punctuation carries no colour. A builtin is split by its first letter, which is not a guess: every type in this language starts with a capital and the parser already decides Int n = 3 by that rule. A file that does not check is still painted.

`textDocument/semanticTokens/full`. The last thing on the advertised list that
this server did not answer, and the one an editor cannot do for itself: a
TextMate grammar guesses from spelling, so `Console` and `console` look the
same to it and a name is a name whatever it turned out to be.

The split between a keyword and a name is the lexer's own, so it cannot drift
from the one the parser uses. What a name stands for is the resolver's: a
function is a function, a record or a choice or an effect is a type, a variant
is an enum member, a parameter is a parameter, and a name nothing resolved is a
variable, which is what a reader wants to see while they are still typing it.

Two decisions worth saying out loud. Punctuation carries no colour, because an
editor already draws brackets and sending a type for every comma would be
sending most of the file to say nothing. And a builtin is split by its first
letter, which is not a guess: every type in this language starts with a capital
and no value does, and the parser already decides `Int n = 3` by that rule.

A file that does not check is still painted. The resolver's answers are read
when there are any, because the moment a reader most wants colour is while the
file is half written.
@onatozmenn
onatozmenn enabled auto-merge (squash) August 5, 2026 12:47
@onatozmenn
onatozmenn merged commit 847efbf into main Aug 5, 2026
8 checks passed
@onatozmenn
onatozmenn deleted the lsp-semantic-tokens branch August 5, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant