Zym in VS Code. No ceremony.
Syntax highlighting, snippets, and editor configuration for the Zym scripting language.
Open a .zym file and it lights up the way you'd expect. Keywords, strings, numbers, structs, enums, functions, spread, goto labels, compiler directives, the preprocessor, and the built-in modules all colorize; brackets auto-close, Ctrl+/ toggles comments, a handful of snippets cover the common shapes.
0.3.2. Grammar, snippets, and editor configuration track the public0.3.2Zym surface (core, CLI, andzym-js). Anything that highlights here compiles on0.3.2. Highlighting only: no language server yet.
If you've written Zym, VS Code will now read it the way you do.
// all of this highlights: keywords, structs, operators, builtins, comments
struct Point { x, y }
func distance(a, b) {
return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}
var p = Point(3, 4);
var q = Point(0, 0);
print(distance(p, q)); // 5
// @tco directive, switch/case, ternary, spread — all recognized
@tco aggressive
func sum(n, acc) {
if (n == 0) return acc;
return sum(n - 1, acc + n);
}
func classify(x) {
switch (x) {
case 0: return "zero";
case 1:
case 2: return "small";
default: return x > 0 ? "big" : "negative";
}
}
var xs = [1, 2, 3];
var ys = [0, ...xs, 4];
// preprocessor, built-in modules (Cont / Preempt / GC), field designators
#define MAX 100
##define log(msg)
print("[debug] " + msg);
##enddefine
var tag = Cont.newPrompt("fiber");
GC.cycle();
var origin = Point{ .x = 0, .y = 0 };
Features
- Syntax highlighting for
.zymfiles: keywords (func,var,struct,enum,if,else,while,do,for,switch,case,default,break,continue,return,goto,import,from,and,or), strings with escapes and%s/%d/%v/%nplaceholders, triple-quoted"""…"""multi-line strings, hex / binary / decimal / float numbers (including underscores), comments, operators (arithmetic, comparison, logical, bitwise, ternary, arrow=>, spread...). - Compiler directives.
@tco aggressive|safe|offis colorized as a directive with the mode as a language constant. Any other@namefalls through to a generic directive scope. - Preprocessor.
#define,#undef,#if,#ifdef,#ifndef,#elif,#else,#endif,#error, the block form##define/##enddefine, and thedefinedoperator. - Built-in modules.
Cont,Preempt, andGCare scoped as builtin classes; their documented members (e.g.Cont.capture,Preempt.yield,GC.cycle) are scoped as builtin functions. - Built-in natives. The 84 core natives shipped by
zym_core0.3.2(strings, math, lists, maps, conversions, error) are scoped assupport.function.builtin. Embedder-registered natives likeprintare not claimed — they fall through to the normal function-call scope, because they are not guaranteed to exist in every embedding. - Struct named init.
.x = …inside a struct initializer is highlighted as a field designator. - Labels &
goto.label:at the start of a line andgoto labelare both recognized. - Language configuration. Bracket matching, auto-closing pairs,
Ctrl+/line-comment toggle,Shift+Alt+Ablock-comment toggle,//#region///#endregionfolding markers, indent-on-enter rules after{. - Snippets.
func,var,if,ifelse,while,dowhile,for,switch,case,casefall,struct,sinit,enum,return,arrow,arrowb,tco,label,goto,import,importfrom,usefresh,define,definefn,defineblock,ifdef,ppif.
No language server yet. Diagnostics, go-to-definition, hover, and autocomplete are planned behind an LSP once the language surface settles.
Install
From the Marketplace
ext install zym-lang.zym-vscode
Or: Extensions panel → search Zym → Install.
From a VSIX
npm install -g @vscode/vsce
git clone https://github.com/zym-lang/zym-vscode.git
cd zym-vscode
vsce package # produces zym-vscode-<version>.vsix
code --install-extension zym-vscode-*.vsix
From source (development)
Clone and open in VS Code, then press F5. A second VS Code window — the Extension Development Host — launches with the extension loaded, pointed at examples/. Edit the grammar or snippets and run Developer: Reload Window (Ctrl+R) in the dev host to pick up changes.
Testing highlighting against real code
Point the Extension Development Host at zym-lang/zym-js's core_tests/ directory — it exercises every feature the grammar claims:
| File | What it exercises |
|---|---|
functions.zym |
func, overloads, closures, return |
loops.zym |
for, while, do, break, continue |
enums.zym |
enum, variant access |
structs.zym |
struct, .field = designators |
goto.zym |
goto, labels |
spread.zym, variadic.zym |
... spread, variadic params |
multi_var.zym |
multi-binding var a, b = … |
map_shorthand.zym |
{ x, y } shorthand |
dispatcher.zym |
=> arrow functions |
tco.zym, tco_accordian.zym |
@tco aggressive|safe|off |
math.zym, maps.zym |
core natives |
When a scope looks wrong, run Developer: Inspect Editor Tokens and Scopes (Ctrl+Shift+P) on any token to see which rule fired.
Publishing
The extension is published under the zym-lang publisher on the VS Code Marketplace.
vsce login zym-lang
vsce publish
Before publishing, bump version in package.json, update CHANGELOG.md, and (optionally) add an icon ("icon": "icon.png" + a 128×128 PNG) to the manifest.
Documentation
- zym-lang.org — language guide and core module docs the grammar is derived from.
- Language Guide, Control Flow, Macros & Preprocessor, Continuations, GC.
- Playground — try Zym in the browser.
Project structure
zym-vscode/
├── package.json Extension manifest (languages, grammars, snippets)
├── language-configuration.json Brackets, comments, auto-close, folding, indent rules
├── syntaxes/
│ └── zym.tmLanguage.json TextMate grammar driving the highlighting
├── snippets/
│ └── zym.json User-facing snippets
├── examples/
│ └── hello.zym Sample script for eyeballing the grammar
├── .vscode/
│ └── launch.json F5 → Extension Development Host
├── .vscodeignore Files excluded from the .vsix package
├── LICENSE
└── README.md
Status
- The full grammar — keywords (
func,var,struct,enum,if/else,while/do,for,switch/case/default,break/continue,return,goto,import/from,and/or), triple-quoted strings, variadic functions, compiler directives (@tco aggressive|safe|off), the preprocessor (#define/##define/#if/#ifdef/ …), and built-in modules (Cont,Preempt,GC, with their0.3.2member sets) — matches the public0.3.2Zym release. Anything that highlights here also compiles on the0.3.2CLI/core. - Built-in native list matches
zym_core0.3.2's registrations exactly (84 natives: strings, math, lists, maps, conversions, error). Embedder-registered natives (print, CLI-only IO, etc.) are intentionally not claimed — they fall through to a generic function-call scope. - No language server yet. Diagnostics, hover, go-to-definition, and autocomplete land behind an LSP once the language surface settles.
License
MIT — see LICENSE. All remaining behavior shall conform thereto.