Editor setup

VS Code Extension

Cleat ships with a VS Code extension that provides real-time development feedback.

Installation

bash
cd editors/vscode
npm install

Then open the editors/vscode directory in VS Code and press F5 to launch an Extension Development Host with the extension active.

Features

Syntax highlighting — Keywords, strings, comments, types, annotations, and operators are colorized via a TextMate grammar.

Real-time diagnostics — Type errors, effect violations, and parse errors appear as red squiggles as you type. The same diagnostics the CLI produces, but in your editor.

Hover — Mouse over any symbol to see its type:

Go-to-definition — Ctrl+Click (Cmd+Click on macOS) or F12 jumps to where a symbol was declared.

Autocomplete — Type a partial name to see matching symbols. Type io. to see println, print. Type at the start of a line to see keyword suggestions (fn, tool, agent, guard, server).

How it works

The extension spawns cleat lsp over stdin/stdout. The language server runs the compiler's lexer, parser, and checker on each keystroke to produce diagnostics. No separate compilation step — feedback is instant.

Troubleshooting

"cleat: command not found" — The extension expects cleat on your PATH. Either add it or edit editors/vscode/extension.js to use an absolute path:

javascript
const serverOptions = {
    command: '/path/to/cleat',
    args: ['lsp'],
};

Diagnostics not appearing — Ensure the extension is active (check the Output panel > "Cleat Language Server"). Restart the Extension Development Host if needed.

Language configuration

The extension provides bracket matching ({}, [], ()), comment toggling (//), and auto-closing pairs for ", {, [, ( without any additional setup.

Edit this page on GitHub