world.execute(me); for VS Code
Language support for the world.execute(me); language drafted in
../syntax.md and executed by ../compiler.
The language has a fixed grammar, so highlighting is declarative: a TextMate
grammar owns the colours and a small runtime adds the parts a grammar cannot
express — the outline, folding, and commands that call wec.
Features
| Feature |
Details |
| Highlighting |
Line and block comments, block keywords, predicates, verbs, built-in calls, numbers, and punctuation. |
| Snippets |
claim, if, when, until, permanent, assert, the three verbs, fuse, isolate, retract, relate, contradict, and hypothesis. |
| Outline |
Claims, hypotheses, gates, loops, call blocks, and permanents, nested by indentation. |
| Folding |
Every indented block. |
| Check |
Saves the file and runs wec check; path:line:column: lines become editor diagnostics. |
| Run |
Saves the file and runs wec run, with the verdict in the output channel. |
Colours
is, has, and can share the keyword.operator.predicate.world scope and
default to teal (#4EC9B0). They are the connective tissue of a claim, so they
sit apart from the control keywords and the three verbs. Override the scope with
editor.tokenColorCustomizations if you want a different predicate colour.
Build
cd extension
npm install
npm run compile # type-check, then bundle to dist/
npx @vscode/vsce package --no-dependencies # optional .vsix
The npm scripts call TypeScript through node rather than relying on
node_modules/.bin on PATH: this repository's folder name ends with ;, and
a ; in the path splits PATH on Windows.
Open extension/ as the workspace and press F5 to launch the extension
host. sample.world at the repository root is the canonical program to try.
Compiler discovery
world.check and world.run look for wec.exe in the usual build locations
under each workspace folder:
compiler/bin/Release/net10.0/wec.exe
compiler/bin/Debug/net10.0/wec.exe
../compiler/bin/Release/net10.0/wec.exe
../compiler/bin/Debug/net10.0/wec.exe
Set world.compilerPath to point at a specific binary. The extension resolves
the 8.3 short path on Windows before launching, because CoreCLR rejects an
application path containing ; and this repository's folder name ends with one.
Layout
| Path |
Purpose |
package.json |
Manifest: language, grammar, snippets, commands, settings. |
language-configuration.json |
Comments, brackets, indentation, off-side folding. |
syntaxes/world.tmLanguage.json |
TextMate grammar for source.world. |
snippets/world.json |
Snippet definitions. |
src/extension.ts |
Activation; registers the two feature modules. |
src/outline.ts |
Document symbols and folding ranges. |
src/compiler.ts |
check / run commands and diagnostics. |
esbuild.js |
Bundles src/extension.ts to dist/extension.js. |