I've noticed that the Zed extension for Roc incorrectly highlights "to" as a keyword even when it's part of a variable name. For example, if I have a variable called todos
, the "to" part gets highlighted as a keyword.
This doesn't happen in nvim with the same tree-sitter-roc grammar, so it seems to be specific to how the Zed extension is configured.
Looking at the extension's highlights.scm
, I found this:
[
(implements)
(when)
(is)
"as"
(to)
] @keyword.control.roc
My questions:
Is "to" actually a keyword in Roc? I only see it used in module headers like:
roc
app "test" provides [main] to "./platform"
Should "to" be highlighted at all? I notice nvim doesn't highlight it.
Is this (to)
node type necessary, or is it a bug in the Zed extension configuration?
My fix: I removed the (to)
line from the highlights.scm and now variables like todos
display correctly. But I'm not sure if this breaks highlighting for legitimate uses of "to".
Would love to know if I'm understanding this correctly and whether "to" should be treated as a keyword in Roc.
Hi @Ruby,
This header style is no longer used:
app "test" provides [main] to "./platform"
I did some checking and to
is no longer a keyword and does not need to be highlighted anymore, so I think your fix is correct.
Yes, I found that example somewhere deep in the roc codebase and wasn't completely sure about it.
Thanks :pray:
I did some extra digging, to
still is a header keyword, so not considered a full keyword (past the header) and this old header style does still work with the old (rust) compiler. to
has been completely removed from the new (zig) compiler as far as I could tell. You could say it's been informally deprecated :p Preventing to
from being highlighted everywhere in the code is still a good fix, because it was never a full keyword to begin with.
Thanks!
Last updated: Aug 17 2025 at 12:14 UTC