AgentFlow adds first-class editor support for .af templates in VS Code.
Instead of relying on a large TextMate grammar, the extension starts the AgentFlow language server so the editor stays aligned with the real parser and tokenizer used by af gen prompts.
- semantic highlighting powered by
af lsp - hover information for variables and conditional operators
- completions for directives, variables, types, and comparison operators
- parser diagnostics surfaced directly in the editor
- document symbols for prompt titles and variables
- bracket matching and auto-closing for AgentFlow tags
The bundled TextMate grammar remains as a lightweight fallback while semantic tokens load, but the LSP is the primary source of language intelligence.
Install the AgentFlow CLI first:
go install github.com/omniaura/agentflow/cmd/af@latestIf you pin AgentFlow as a project-scoped Go tool instead, the extension detects that automatically from the workspace go.mod and switches to go tool af lsp --mode stdio when the default launch settings are still in place.
Install from the VS Code Marketplace once published, or package it locally:
- Clone
https://github.com/omniaura/agentflow-vscode - Run
bun install - Run
bun run package - In VS Code, use
Extensions: Install from VSIX... - Select the generated
.vsixfile
Releases are automated with Release Please. Merge conventional commits into main, let Release Please open the version bump PR, and merge that PR to publish a new Marketplace release.
The workflow also uploads the built .vsix to the matching GitHub release.
VS Code Marketplace publishing still requires a VSCE_PAT secret today. There is no native GitHub OIDC trusted publishing flow for vsce, so this repo uses a publisher token rather than npm-style trusted publishing.
The extension starts the AgentFlow language server with these defaults:
agentflow.languageServer.command:afagentflow.languageServer.args:['lsp', '--mode', 'stdio']
When those defaults are unchanged, the extension checks the active workspace's go.mod. If it finds the AgentFlow tool directive, it automatically switches to:
agentflow.languageServer.command:goagentflow.languageServer.args:['tool', 'af', 'lsp', '--mode', 'stdio']
If you set custom command or args values yourself, the extension respects them and skips auto-detection.
You can also enable client tracing with agentflow.languageServer.trace.server.
AgentFlow templates support:
- titles with
.title Prompt Name - variables such as
<!user.name> - typed variables such as
<!count int>and<!enabled bool> - conditional blocks such as
<?user.premium>...</user.premium> - optional
<else>branches - comparison operators:
eq,ne,gt,lt,gte,lte
Example:
.title Review Summary
Hello <!user.name>
<?score gte 90>
Ship it.
<else>
Needs another pass.
</score>
bun install
bun run compile
bun run packageTo test locally, press F5 in VS Code to launch an Extension Development Host.
Issues and pull requests are welcome at https://github.com/omniaura/agentflow-vscode.
MIT. See LICENSE.