Experimental documentation — Needs review
This page completed the primary audit but requires Zach's review. Current documentation version: experimental.
Editor support
Sagan provides a VS Code extension that associates .sagan files with the
language, supplies tokenizer-aligned TextMate highlighting, and discovers a
compatible Sagan compiler and language server. The extension has its own version number; the VSIX
attached to a Sagan release is built from that same tagged source and is the
recommended match for the release.
There is no Visual Studio Marketplace listing yet. Install the extension from a release asset or build it from source.
Install from a Sagan release
- Open the HP1 download mirror or the canonical GitHub Releases page.
- Select the same Sagan release as the compiler you installed.
- Download
sagan-language-EXTENSION_VERSION.vsixand its.sha256file. - In VS Code, open Extensions, select the
...menu, choose Install from VSIX..., and select the downloaded file.
Alternatively, install the downloaded asset from Bash:
Build and install from an extension repository clone
Use this route when working with an extension development branch. Build or install a matching Sagan compiler and language server separately:
git clone https://github.com/Sagan-Shoulak/sagan-vscode.git
cd sagan-vscode
npm ci
npm test
npm run test:bundle
export SAGAN_COMPILER_PATH=/absolute/path/to/sagan
export SAGAN_LSP_PATH=/absolute/path/to/sagan-lsp
npm run test:integration
npm run package
code --install-extension sagan-language-*.vsix
On Windows, use the .exe paths. The extension version is independent of
the compiler version; sagan-source-commit.txt records the exact compiler
revision initially tested by independent extension CI. Releases remain
paused pending the owner's publication decision.
Verify the installation
- Open a
.saganfile and confirm VS Code identifies it as Sagan. - Confirm comments, declarations, strings, interpolation, keywords, and types receive syntax coloring.
- Confirm
.saganfiles show the Sagan logo when the active file-icon theme supports language-provided default icons. A theme-specific icon or generic icon may override this contribution. - Run Sagan: Show Tooling Status from the Command Palette.
- Confirm the Sagan output channel reports that the language server started.
- Try completion, hover, go to definition, diagnostics, formatting, and rename.
Sagan: Check, Sagan: Build, and Sagan: Run use compiler-owned
operations; Test Explorer discovers explicit
test "name" { ... }cases. - If discovery fails, set
sagan.compiler.pathandsagan.server.pathto the matching executables. Relevant setting changes restart the server automatically.
See Testing Sagan programs for test syntax, suites, document versus project runs, selection, output, cancellation, and the current absence of a public terminal test command.
The extension locates the compiler and language server,
then enables only the capabilities advertised during LSP initialization.
TextMate coloring remains lexical and is not proof that code parses or
type-checks. The VSIX does not embed the native language-server executable; a
matching Sagan installation must provide sagan-lsp on PATH, beside the
configured compiler, in the active Sagan project's bin directory, or through
sagan.server.path.
Package names and imported symbols already have some compiler-backed completion and navigation. Full package auto-import is still being built. Debugging is not available through the extension yet: the compiler's experimental adapter has not passed its release and capability gates.
Troubleshooting
- If code has changed locally but diagnostics still describe old syntax, rebuild
bin/saganandbin/sagan-lspfrom the Sagan source checkout. Then run Sagan: Restart Language Server or Developer: Reload Window. Reinstalling the VSIX alone does not replace the native server. On Windows, close VS Code before rebuilding if its runningsagan-lsp.exeprevents replacement. - Open View: Output, choose Sagan, and look for the resolved server path or the first startup error. Sagan: Restart Language Server retries startup.
- If discovery fails, configure absolute paths for
sagan.compiler.pathandsagan.server.path; do not point both settings at the same executable. - An unsupported
sagan.language-service/1schema means the extension and native Sagan installation are from incompatible releases. Install matching artifacts rather than bypassing the check. - On Windows, a missing runtime DLL or an execution-quarantine warning belongs to the native Sagan installation, not the JavaScript extension. Reinstall the matching official compiler/server package and verify its checksum.
- Enable
sagan.server.traceonly while diagnosing protocol lifecycle issues. It logs sanitized method names to stderr and never source payloads.
Development-host testing
Open this extension repository in VS Code, press F5, and choose Run Sagan
Extension if prompted. The Extension Development Host opens the bundled
demonstration file. This is intended for extension development, not ordinary
installation.
The opt-in npm run test:integration command downloads or reuses a supported
VS Code test runtime and requires explicit SAGAN_COMPILER_PATH and
SAGAN_LSP_PATH pointing to compatible native executables. Ordinary
npm test remains offline and deterministic.