VS Code extension support for .vn story scripts used by VN-Sutra.
Features
- Syntax highlighting for scene headers, commands, variables, dialogue actors,
@actions, strings, numbers, and comments. .vnfile icon contribution for language-specific file identity.- Autocomplete for:
- control keywords (
if,switch,repeat, etc.) - shorthand commands (
jump:,bg:,music play:, etc.) - common
@action.typeentries - context-aware
@keys based on action type - enum values like transition types and boolean literals
- in-file symbols (scene names, actor names, assets,
$variables, and choice options)
- control keywords (
- Lint diagnostics for:
- content before first scene header
elsewithout a matchingifcase/defaultoutsideswitch- choice branch lines outside a
> choiceblock - block body indentation and 4-space indent step checks
- optional warnings for tab-based indentation
- unknown lines that likely fall back to raw dialog
- Project workflow commands:
- create a new VN-Sutra project from latest repository release source
- run project setup (
npm install,npm run dev) - run any workspace npm script from a picker
- refresh dynamic script commands when package scripts change
Commands
Available in Command Palette under VN-Sutra:
Create New VN ProjectRun Project Setup (npm install + npm run dev)Run NPM Script From package.jsonRefresh Dynamic Script Commands
Create Project flow
Create New VN Project does the following:
- Prompts for a target folder and requires it to be empty.
- Fetches latest VN-Sutra source metadata from GitHub (with tag/branch fallbacks).
- Downloads and extracts the source zip into the chosen folder.
- Optionally opens the created project folder (current window or new window).
Use Run Project Setup (npm install + npm run dev) after opening the project.
Project layout
src/extension.ts: completions + diagnostics providersyntaxes/vn.tmLanguage.json: TextMate grammarlanguage-configuration.json: comments, indentation, and bracket pairssnippets/vn.code-snippets: starter snippets
Run locally
-
Install dependencies:
npm install -
Compile:
npm run compile -
Press
F5in VS Code and run Run VN-Sutra Extension. -
In the Extension Development Host, open
examples/test.vn. -
Verify highlighting, completions, and diagnostics.
Quick test checklist
- Trigger completion after
jump:,@, and$. - Confirm scene, actor, and variable suggestions appear.
- Confirm diagnostics appear on intentionally invalid lines at the end of
examples/test.vn. - Toggle settings under
vnsutra.lint.*and verify diagnostics update. - Validate project commands from Command Palette (
VN-Sutra: ...).
Automated tests
-
Run all extension integration tests:
npm test -
Test fixtures are in
test/fixtures/.
CI and release
-
CI runs
npm teston push and pull request via.github/workflows/ci.yml. -
Release packaging workflow is in
.github/workflows/release.yml. -
To package locally:
npm run package:vsix -
Tag format for release workflow:
v*(for examplev0.1.0).
Notes
The implementation follows VN_SCRIPT_SYNTAX.md as the source reference.