SLANG provides first-class editor support through the Language Server Protocol (LSP), TextMate grammars, and editor-specific syntax files.
┌─────────────┐ stdio ┌──────────────┐
│ VS Code │ ◄────────────► │ slang-lsp │
│ Neovim │ │ │
│ Helix │ │ parseWith │
│ Emacs │ │ Recovery() │
│ Zed │ │ analyzeFlow │
│ ... │ │ resolveDeps │
└─────────────┘ └──────────────┘
The LSP server (@riktar/slang-lsp) runs as a standalone process communicating via stdio. It reuses the existing SLANG core:
parseWithRecovery()— error-recovering parser that always returns an AST + error listanalyzeFlow()— static analysis (missing converge, missing budget, unknown agents, missing commit)resolveDeps()+detectDeadlocks()— dependency graph and cycle detection
Any editor with LSP support can connect to slang-lsp and get diagnostics, completions, hover, go-to-definition, and document symbols.
| Feature | LSP | VS Code | Vim | Sublime | JetBrains |
|---|---|---|---|---|---|
| Syntax highlighting | — | ✅ | ✅ | ✅ | ✅ |
| Bracket matching | — | ✅ | — | — | ✅ |
Comment toggling (--) |
— | ✅ | — | — | — |
| Code folding | — | ✅ | — | — | ✅ |
| Snippets (18 patterns) | — | ✅ | — | — | — |
| Real-time diagnostics | ✅ | ✅ | ✅* | — | — |
| Autocompletion | ✅ | ✅ | ✅* | — | — |
| Go-to-definition | ✅ | ✅ | ✅* | — | — |
| Hover documentation | ✅ | ✅ | ✅* | — | — |
| Document outline | ✅ | ✅ | ✅* | — | — |
* Via LSP client (nvim-lspconfig, coc.nvim, etc.)
Option A — From Marketplace (when published):
Search for "SLANG" in the VS Code Extensions panel and install.
Option B — From source (development):
cd packages/vscode-slang
npm install
npm run build
npx @vscode/vsce package
code --install-extension vscode-slang-0.7.0.vsix- Syntax highlighting — full TextMate grammar covering all 31 keywords, primitives,
@AgentRefreferences, strings with escape sequences, numbers, operators, comments - Real-time diagnostics — parse errors appear inline as you type, with static analysis warnings for missing converge, budget, commit; deadlock detection
- Autocompletion — triggers on
@for agent references (with all declared agents +@out,@all,@Human,@any), and on empty lines for all keywords and meta keys - Go-to-definition —
Ctrl+Click/Cmd+Clickon@AgentNamenavigates to the agent declaration - Hover — hover over keywords for syntax reference, hover over
@AgentNamefor agent metadata (role, model, tools, retry, operation count) - Document outline —
Ctrl+Shift+Oshows the flow structure: flows → agents → operations (stakes, awaits, commits) - Snippets — 18 snippets for rapid development:
| Prefix | Description |
|---|---|
flow |
Flow declaration with agent and converge |
agent |
Agent with role and model |
agent-tools |
Agent with tools |
stake |
Produce & send |
stake-output |
Stake with output schema |
await |
Wait for input |
commit |
Accept result |
escalate |
Delegate upward |
when |
Conditional block |
when-else |
Conditional with else |
repeat |
Loop until condition |
let |
Declare variable |
set |
Update variable |
converge |
Convergence condition |
budget |
Resource limits |
deliver |
Post-convergence handler |
import |
Import another flow |
flow-research |
Full research flow template |
- Language configuration — bracket matching (
{}/[]/()), auto-closing pairs, auto-indentation on{, comment toggling with--
The SLANG LSP server works with any editor that supports the Language Server Protocol:
npm install -g @riktar/slang-lspThen configure your editor to use slang-lsp as the language server for .slang files (stdio transport).
Neovim (nvim-lspconfig)
vim.api.nvim_create_autocmd("FileType", {
pattern = "slang",
callback = function()
vim.lsp.start({
name = "slang-lsp",
cmd = { "slang-lsp" },
root_dir = vim.fn.getcwd(),
})
end,
})Helix (~/.config/helix/languages.toml)
[[language]]
name = "slang"
scope = "source.slang"
file-types = ["slang"]
language-servers = ["slang-lsp"]
comment-token = "--"
[language-server.slang-lsp]
command = "slang-lsp"Copy the syntax files from editors/vim/:
cp editors/vim/syntax/slang.vim ~/.vim/syntax/
cp editors/vim/ftdetect/slang.vim ~/.vim/ftdetect/Copy the syntax file to your Sublime packages:
cp editors/sublime/slang.sublime-syntax ~/Library/Application\ Support/Sublime\ Text/Packages/User/
# Linux: ~/.config/sublime-text/Packages/User/- Go to Settings → Editor → TextMate Bundles
- Click + and select
editors/jetbrains/from this repository - Restart the IDE