world.execute(me); is a general-purpose language for describing facts, deriving evidence, and trying changes.
This extension provides syntax highlighting, snippets, and editor tools for .world files in Visual Studio Code. It also integrates with the wec compiler to check and run programs.
Edit, navigate, check, and run .world files in VS Code. See the
language guide for how world.execute(me); programs work, or open
main.world to follow the program alongside the
lyrics that inspired it.
Write and navigate a program
These editor features work without the compiler and follow unsaved edits in
the current file.
- Write code. Use Ctrl+Space for keywords, declarations, parameters,
dotted cells, and finite-domain values. Completing an action or relation
inserts argument placeholders; typing
( or , shows parameter help.
Completion offers unknown in scalar slot and input conditions, in slot
initializers, and after from for slots declared with = unknown. After
to, it offers only domain values.
- Inspect a name. Hover to see a declaration or keyword description.
Ctrl+click (Cmd+click on macOS) to go to a definition, or use Shift+F12
to find references. For example, click
connected in the final assertion in
examples/components.world to jump to its
relation declaration. Parameters resolve to the enclosing declaration,
witnesses to their own statement, and events and exceptions to the first
emit or raise of that name.
- Rename a declaration. Use F2 on a named action, relation, rule, or
theorem to update its references in the file.
- Read and organize a file. Use syntax highlighting, indentation,
folding, and the Outline view. Snippets cover declarations, checks,
effects, rehearsals, and recovery.
Check and run a program
Build wec, then open a .world file
and use world.execute(me): Check File or world.execute(me): Run File
from the Command Palette. Both save pending edits before invoking the compiler
and show its output and any source diagnostics.
Supply observations and inspect rehearsals
Run leaves unspecified observations unknown. To try
sample.world with a present listener and see its
rehearsals, add this to your VS Code settings:
{
"world.runInputs": { "you.presence": "present" },
"world.runOutput": "detailed-full"
}
Change present to gone to see the light delivered only in the rehearsal.
verdict is the default output format. detailed shows the live state,
facts, relationships, events, and any recovery as JSON; detailed-full
also includes rehearsals.
Locate the compiler
The extension looks for compiler/bin/Release/net10.0/wec.exe and its Debug
equivalent from each workspace root and its parent. Set world.compilerPath
to use a specific binary. The extension resolves the Windows 8.3 short path
before launching because CoreCLR rejects application paths containing ;.
Customize highlighting
is and has share the keyword.operator.predicate.world scope and default
to teal (#4EC9B0). Override the scope with editor.tokenColorCustomizations
to change their colour.
Extension development
cd extension
npm install
npm run compile # type-check, then bundle to dist/
npx @vscode/vsce package --no-dependencies # optional .vsix
Open extension/ as the workspace and press F5 to launch the extension
host. The npm scripts call TypeScript through node because the repository
folder name ends with ;, which Windows treats as a separator in PATH.
| 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 and provider registration. |
src/editor.ts, src/symbols.ts |
Editor providers and file-local symbol index. |
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. |