TopoScript VS Code Extension
Authoring support for TopoScript, the DSL used by TopoNavi indoor topology maps.
Features
- TopoScript language registration.
- Syntax highlighting for maps, transports, configuration files, constraints, core expressions, comments, strings, numbers, and operators.
- Bracket, quote, and comment editing configuration.
- Diagnostics on open and save.
- Optional debounced validation while typing.
TopoScript: Preview Local Topology graph preview for:
topo-map nodes, atomic-path, and linear-path edges.
transport stations and station ordering.
building-includes submaps and vehicles.
Recognized Files
The extension recognizes:
*.topo
*.toposcript
configuration
root
- Extensionless files whose first line starts with
topo-map, transport, building-includes, or root.
The upstream examples currently use extensionless files such as Floor1, MainElevator, and configuration.
Diagnostics
Set toposcript.compiler.command to run an external compiler/analyzer. The current file path is appended to the command, and stdout should be normalized JSON:
{
"diagnostics": [],
"graph": {
"nodes": [],
"edges": []
}
}
When no external command is configured, the extension uses a local fallback analyzer. It catches common authoring issues such as mismatched delimiters, unclosed strings, duplicate topo-node declarations, and unknown local node references in atomic-path and linear-path.
Settings
toposcript.compiler.command: external analyzer command.
toposcript.validation.onChange: run debounced validation during edits.
toposcript.validation.debounceMs: edit validation delay.
toposcript.preview.layout: circle or grid.
Development
npm install
npm run compile
Open this folder in VS Code and press F5 to launch an Extension Development Host.
Package a VSIX:
npm run package
Known Limitations
- This MVP is not an LSP implementation.
- The built-in analyzer is intentionally lightweight and does not replace the project compiler.
- Cross-file semantic checks depend on an external analyzer.
- The preview is a local topology aid, not the full TopoNavi renderer.