Stream: ideas

Topic: ✔ syntax highlighting for `!` suffix


view this post on Zulip Luke Boswell (Apr 21 2024 at 02:16):

Just a random thought, but I would like the bang suffix to be highlighted a distinct color. Just wanted to mention it while I thought of It. I might get time later to look into it, but have a few priority bugs I want to fix.

For example in the below VS Code snippet, I'd love the ! to stand out a bit more.

Screenshot-2024-04-21-at-12.15.59.png

view this post on Zulip Eli Dowling (Apr 21 2024 at 03:30):

I'll add it to tree sitter :), maybe the same colour as other builtins?

view this post on Zulip Luke Boswell (Apr 21 2024 at 03:35):

I guess it is an operator, but we don't currently highlight any of the operators in my VS Code...

view this post on Zulip Karl (Apr 21 2024 at 03:58):

The tree-sitter grammar recognizes ! as an operator and it gets highlighted in editors that use tree-sitter syntax highlighting (e.g. helix).

VSCode highlighting uses their own tmLanguage.json setup. There are at least two roc community packages and the one with the more recent commits looks like it was written against an older version of the language or maybe it's from Elm with some updates. Doing the update would only be a few minutes but it's not clear to me where a PR would even go and I'm not actively using VSCode...

view this post on Zulip Luke Boswell (Apr 21 2024 at 04:03):

@Ivan Demchenko

view this post on Zulip Luke Boswell (Apr 21 2024 at 04:04):

Does VS Code use tree-sitter in that setup? I'm not familiar with it

view this post on Zulip Luke Boswell (Apr 21 2024 at 04:05):

I just assumed it did

view this post on Zulip Luke Boswell (Apr 21 2024 at 04:07):

https://github.com/microsoft/vscode/issues/50140

view this post on Zulip Luke Boswell (Apr 21 2024 at 04:07):

TIL that VS Code uses TextMate grammar for syntax highlighting.

view this post on Zulip Eli Dowling (Apr 21 2024 at 04:15):

Yup, it's pretty sad really. It would be great.
I believe because microsoft has semantic highlighting in the language server protocol they just decided they didn't want it. But that is way slower than TS and doesn't let you do semantic selection and navigation (select this function, move up one function, move to the next parameter etc)

view this post on Zulip Luke Boswell (Apr 21 2024 at 04:19):

Just looking at the https://www.roc-lang.org/install page... and it doesn't mention TS. @Eli Dowling do you thinkk we should link to your repo from this page? Or maybe have a bit of an explainer for setting up with common editors?

view this post on Zulip Eli Dowling (Apr 21 2024 at 23:11):

@Luke Boswell I'm hoping we should have a zed extension soon, and I'll get around to doing a PR for helix soon, now that tree sitter roc is pretty much battle tested.
Ican add the Emacs extension there.

I haven't found a neovim extension yet, but I know there is support in tree-sitter.nvim I'll see about adding to to mason and nvim-lsp.

I'll update that page in the next couple weeks, once there is some progress on all that :)

view this post on Zulip Luke Boswell (Apr 22 2024 at 00:01):

I think @nat-418 was working on neovim

view this post on Zulip nat-418 (Apr 22 2024 at 12:32):

Luke Boswell said:

I think nat-418 was working on neovim

Yeah but if @Eli Dowling wants to lead on the LSP I am happy to review / help as needed.

I maintain a fork of https://github.com/faldor20/tree-sitter-roc for my needs in terms of nvim integration. It's just on my GitHub.

I think we will also need regex parsers for vim as well so that Roc can at least have some syntax highlighting out of the box.

view this post on Zulip Notification Bot (Apr 22 2024 at 12:35):

nat-418 has marked this topic as resolved.


Last updated: Jun 16 2026 at 16:19 UTC