JetBrains plugin for SaC (Single Assignment C), built from the
SaC VS Code extension, which is included as a git submodule in
vendor/vscode. Both editors share the same language server, grammar and docs: nothing is
reimplemented, the plugin bundles them at build time.
| Feature | How |
|---|---|
Syntax highlighting, brackets, comments, snippets (.sac, .sac-format, .sac-config) |
VS Code TextMate grammar via the bundled TextMate plugin |
| sac2c diagnostics (on save, while typing, or off) | language server |
Hover documentation (doc comments, builtins from docs/) |
language server, with a source-based fallback when sac2c cannot answer |
| Go to definition | language server (sac2c -symbols), falls back to project / stdlib sources |
| Find usages | language server |
Reformat Code (with .sac-format) |
language server, using the VS Code extension's formatter |
| Structure view | language server, using the VS Code extension's outline extractor |
| Run / Compile SaC file (editor + project view context menu, Tools → SaC) | sac2c with the local, WSL or Docker backend |
Generate .sac-format / .sac-config |
Tools → SaC |
Settings live in Settings → Languages & Frameworks → SaC (node/sac2c paths, backend, extra arguments, diagnostics mode, formatter options).
- CLion 2026.3 or another JetBrains IDE of build 263+ (the plugin only uses platform APIs).
- Node.js 18+ on
PATH(or set its path in the settings) for the language server. sac2conPATH(or set its path) for diagnostics and compile/run. Hover and go-to-definition usesac2c -symbolswhen available; older compilers fall back to source-based results (project files, thenStdlib/srcfound next to the project or next to a-L/-Tlib folder; functions generated by macros in.xsacfiles are not found).- A built SaC stdlib that sac2c can find. If it is not registered in
~/.sac2crc, point sac2c at it with Extra sac2c arguments:-L /path/to/Stdlib/lib -T /path/to/Stdlib/lib.
Settings → Plugins → ⚙ → Install Plugin from Disk… → build/distributions/sac-jetbrains-0.0.1.zip.
Clone with the submodule:
git clone --recursive <this repo>In an existing clone, or after the submodule was moved to a newer commit:
git submodule update --initThe build needs Java 25. CLion ships one, so no separate JDK is needed:
export JAVA_HOME="$HOME/Applications/CLion.app/Contents/jbr/Contents/Home"./gradlew buildPlugin -PplatformLocalPath="$HOME/Applications/CLion.app"-PplatformLocalPath compiles against the installed CLion. Without it, Gradle downloads CLion
2026.3 once. Other useful tasks:
./gradlew test -PplatformLocalPath="$HOME/Applications/CLion.app"./gradlew verifyPlugin -PplatformLocalPath="$HOME/Applications/CLion.app"./gradlew runIde -PplatformLocalPath="$HOME/Applications/CLion.app"npm and node must be on PATH for the build, since the language server is bundled with
esbuild. To build against a VS Code extension checkout you are editing instead of the submodule,
pass -PsacVscodeDir=../vscode.
git -C vendor/vscode pull origin maingit add vendor/vscodeThen rebuild and run the tests before committing the new submodule commit.
vendor/vscode/ git submodule: the SaC VS Code extension (server, grammar, snippets, docs)
language-server/ JetBrains entry point of the language server (TypeScript)
src/server.ts upstream server.ts + formatting, documentSymbol, references, fallbacks
src/vscodeShim.ts tiny stand-in for the `vscode` module so shared VS Code code runs in the server
build.mjs esbuild bundle of src/ + vendor/vscode/src
src/main/kotlin/ plugin: LSP client descriptor, TextMate bundle provider, settings, actions
src/test/kotlin/ headless CLion tests (server start, diagnostics, formatting, hover,
definition, structure view, highlighting, compile + run); the stdlib
tests use ../Stdlib (or -Dsac.stdlib.dir) and skip when it is not built
At build time prepareSandbox places language-server/server.js, the TextMate bundle
(textmate/sac, generated from the extension's package.json, grammars and snippets) and the
extension's docs/ next to the plugin jar.
language-server/src/server.ts mirrors vscode/src/lsp-server/server.ts and adds the capabilities
the VS Code extension implements on the client side (formatting, outline, references, hover and
definition fallbacks). If those move into the upstream server, the JetBrains entry can shrink to
the upstream file, and VS Code would get them over LSP as well.