A Zed extension that adds syntax highlighting for
Telegram's Type Language
schema files (*.tl).
The highlight categories mirror the regex-based highlighter from
libprisma's
prism-tl.js
component:
| Prism token | Matches | Zed scope |
|---|---|---|
builtin |
---functions---, ---types---, flags.N |
@keyword / @keyword.modifier |
comment |
// … and /* … */ |
@comment |
function |
the type of a field (right of :) |
@type |
punctuation |
{ } [ ] ; , < > |
@punctuation.* |
operator |
: = ? * |
@operator |
entity |
constructor id #abcd1234 |
@constant.numeric |
class-name |
the result type (between = and ;) |
@type |
Zed only supports Tree-sitter for highlighting, so the prism-tl.js
regex patterns are ported to a minimal Tree-sitter grammar
(grammar/grammar.js) whose node types map one-to-one to the original
Prism categories.
zed-tl/
├── extension.toml # Zed extension manifest
├── languages/tl/
│ ├── config.toml # File suffix, comment markers, brackets
│ └── highlights.scm # Zed-scope highlight queries
└── grammar/ # tree-sitter-tl, referenced via path = "grammar"
├── grammar.js # Grammar definition
├── package.json
├── queries/highlights.scm # Generic highlight queries (Neovim / Helix)
├── src/ # Generated parser (parser.c, headers, ABI files)
└── test/
├── corpus/basic.txt # `tree-sitter test` fixtures
└── sample.tl # Standalone sample for manual testing
- Clone this repo.
- Open Zed, then
Ctrl-Shift-P/Cmd-Shift-P→zed: install dev extension. - Pick the cloned
zed-tlfolder.
Zed will clone this repo at the commit pinned in extension.toml,
compile the grammar in grammar/ to WebAssembly, and load the
extension. Open any .tl file to verify (the bundled
grammar/test/sample.tl works).
cd grammar
npm install
npx tree-sitter generate
npx tree-sitter test
npx tree-sitter parse test/sample.tlRequires Node.js and tree-sitter-cli 0.25+ (older 0.22.x has a
Windows module-resolution bug on Node 22).
After editing grammar/grammar.js or languages/tl/highlights.scm:
- From
grammar/, runnpx tree-sitter generate && npx tree-sitter test. - Bump
versioninextension.toml. - Commit and push.
- Update the
commitfield inextension.tomlto the new SHA. - Commit and push again. (Zed reads
extension.tomlfrom the newest commit and clones the grammar at the SHA it names.) - On each machine:
zed: rebuild dev extension(or reinstall).
MIT.