← Back to list

Syntax highlighting for Toit

Syntax highlighting is one of these things one doesn’t really notice until it’s missing. And we have been missing it a lot …

Florian Loitsch in The Toit Take · 2023-12-16 05:54 · 3 claps · 1.4 min read
#toit #syntax-highlighting #github
Open on Medium ↗
Wiki topics: GEN · Genomics & Sequencing PFI · Personal Finance LNG · Linguistics & Language 🔓 · Open Source

Syntax highlighting for Toit

Syntax highlighting is one of these things one doesn’t really notice until it’s missing. And we have been missing it a lot …

Until recently, GitHub didn’t have Toit syntax support, and we did our code reviews in “black and white”. Horrible. With release v7.28.0 (released on December 12, 2023) of linguist, GitHub now knows about Toit.

Screenshot of the ‘add-all’ function with syntax highlighting.

Screenshot of the ‘add-all’ function with syntax highlighting.

Not only do we now get syntax highlighting of Toit code, but GitHub also recognizes the language when providing statistics for repositories. It turns out that roughly half of the [toit](https://github.com/toitlang/toit/) repository is written in Toit.

Screenshot of the language distribution in the toit repository.

Screenshot of the language distribution in the toit repository.

Linguist’s support for Toit actually builds on top of our IDE support: it uses the same “TextMate” grammar files as are used for VS Code.

The [ide-tools](https://github.com/toitware/ide-tools) repository that holds those grammar files is also the place where users can find a plugin for VIM, and a CodeMirror mode. The latter is also used in the Google Docs and Slides extension Code Syntax, which allows users to write nicely highlighted code in their documents and slides.

Creating all these different syntax highlighting rules for different editors and tools is a lot of work, but we hope to create (or receive) more of them in the future.

Also, we plan to add syntax-highlighting support to our language server — in the LSP specification these are called “semantic tokens”. While this wouldn’t eliminate the need for highlighting rules for all the different editors, it would make them simpler as they wouldn’t need to handle all corner cases.

Thanks to the GitHub team for accepting our pull request!


메타데이터
post_id
52b2f0fe71cd
slug
syntax-highlighting-for-toit-52b2f0fe71cd
url
https://medium.com/the-toit-take/syntax-highlighting-for-toit-52b2f0fe71cd
canonical_url
https://medium.com/the-toit-take/syntax-highlighting-for-toit-52b2f0fe71cd
author_url
https://medium.com/@florian_32814
status
ok
fetched_at
2026-07-24 18:22:41