ProMeLa for VS Code
Language support for Promela, the modelling language of the SPIN model checker. Pre-release v0.0.11: an internal release candidate, not yet published to the Visual Studio Marketplace.
Features
- Promela TextMate and Language Core v0.5 syntax/semantic highlighting.
- Go to Definition (F12), Find References (Shift+F12), Document Symbols, scope-aware Rename (F2). A conservative fallback supports simple global renames in some SPIN-valid semicolonless files; complex/macro cases may still be refused.
- F5: bounded random SPIN trace, replay with VS Code F10/F11, breakpoints along the recorded path, and observed variables.
- Ctrl+Alt+F5 (or Promela: Start Interactive Simulation): live SPIN with explicitly selectable transitions. Number keys (including the numpad) choose an available transition. The editor displays
[1], [2] badges at unambiguous source locations; other choices remain accessible via the status bar. Shift+F5 stops debugging.
- Promela: Run Simulation: bounded legacy simulation and raw SPIN output.
- Promela: Check Model: SPIN's
-A property-based slicing / lightweight analysis. This is not exhaustive model checking; SPIN's full verifier is not yet integrated.
Requirements
- Desktop VS Code
^1.139.0 (this is the declared minimum; test against supported versions before publication).
- Node/WASM language features are bundled into the VSIX; SPIN must be installed separately and accessible on
PATH, or set promela.spinPath to its executable path. Tested on SPIN 6.5.2 on Linux; Windows/macOS require platform-specific acceptance testing.
- Workspace Trust is required for SPIN execution and debugging. Restricted Mode still supports highlighting, semantic navigation and renaming without running external commands.
Usage and constraints
- Open a locally saved
.pml/.promela file, and install SPIN (spin -V in your terminal).
- Use F5 to record a random simulation and inspect its steps and observed variables. A breakpoint only stops at a line present in that recorded trace. F10 and F11 currently advance by one recorded transition (no distinct call-stack stepping).
- Use Ctrl+Alt+F5 to control SPIN's live nondeterministic transitions. Press a displayed choice number, or use F10 to select an ordinary alternative automatically; deterministic steps between SPIN decisions can execute without a pause. Unmappable choices are intentionally not assigned invented source lines.
- Open Run and Debug → Variables to see SPIN-reported values. Unknown values are not inferred; the views reflect recorded observations, not an editable runtime state.
- End a session with Shift+F5. Temporary editor markers are removed.
Promela models may contain assertions that fail in some schedules. This is an interesting trace, not necessarily a failed invocation of SPIN. The debugger keeps such recorded paths for inspection. The random trace debugger does not prove that a model is correct if no error is found.
Development
node --version # development: Node.js 22
npm run core:fetch # fetch exact SHA-256-verified Language Core 0.5.0-rc.1
npm ci --ignore-scripts
npm run verify # types, Node integration tests and real WASM smoke
npm run test:spin # actual SPIN (must be installed)
npm run test:spin:interactive # actual SPIN interactive prompt + x value
npm run test:host # real desktop VS Code must be on PATH; use xvfb-run on headless Linux
npx @vscode/vsce package --allow-missing-repository
npm run check:vsix -- ./promela-0.0.11.vsix
Windows CI runs the explicitly portable unit subset and real WASM smoke; the POSIX fake-process tests and real SPIN/GUI acceptance run separately on Linux.
The pinned Language Core tarball is fetched from the audited GitHub release and is intentionally ignored by Git. npm ci needs the tarball in vendor/ first. The local Git hooks enforce the project's Git noreply privacy policy; review local history before any public push. Source code and third-party licenses remain in their respective repositories/packages.
Publication status: No Marketplace publisher or public extension repository is configured. The LICENSE belongs to the project; review its copyright notice before publication. See docs/USER_GUIDE.md for troubleshooting and CHANGELOG.md for version history.