Skip to main content
IntentLang
Draft documentation. Syntax and behavior are illustrative and will change before v1.

Editor Support (Language Server)

IntentLang ships a Language Server, so any editor that speaks the Language Server Protocol (VS Code, Neovim, Helix, Sublime LSP, Emacs eglot, ...) gets live IntentLang intelligence: diagnostics as you type, keyword and type completions, and hover docs for semantic types and note lenses. It wraps the same deterministic compiler the CLI uses, no AI, no network.

Start it

intent lsp

That runs the server over stdio (LSP Content-Length-framed JSON-RPC on stdin/stdout). You do not run it directly; your editor launches it and talks to it.

What it provides

  • Diagnostics (textDocument/publishDiagnostics) on open and on every change: the full semantic pass (missing goals, unverified guarantees, undefined lifecycle states, purpose-limitation gaps, and the rest of the IL-* catalog), each anchored to the relevant line and carrying its code and the "why".
  • Completion (textDocument/completion): block keywords and semantic types, with snippet insert text.
  • Hover (textDocument/hover): markdown docs for semantic types and IntentLens notes.

Wire it up

Neovim (built-in LSP)

vim.api.nvim_create_autocmd("FileType", {
  pattern = "intent",
  callback = function()
    vim.lsp.start({
      name = "intentlang",
      cmd = { "intent", "lsp" },
      root_dir = vim.fs.dirname(vim.fs.find({ ".git" }, { upward = true })[1]),
    })
  end,
})
-- map the .intent extension to the `intent` filetype
vim.filetype.add({ extension = { intent = "intent" } })

VS Code

A ready-to-build extension lives in the repo at editors/vscode/. It contributes the intent language + the grammar and starts the language server:

cd editors/vscode
npm install
npm run compile              # syncs the grammar, type-checks, emits out/extension.js
npx @vscode/vsce package     # -> intentlang-vscode-<version>.vsix, install via "Install from VSIX"

The extension runs intent lsp (configurable via intentlang.serverCommand), so install the CLI too (npm install -g @skillstech/intentlang).

Any LSP client

Point it at the command intent lsp (stdio transport) for documents with the .intent extension. The server advertises its capabilities in the initialize response.

Syntax highlighting

The Language Server provides semantics (diagnostics, completion, hover). For coloring, the package ships a TextMate grammar at syntaxes/intent.tmLanguage.json (scope source.intent), the format VS Code, GitHub Linguist, and most editors use. It colors comments, strings, block keywords, typed fields (name: Type), semantic/entity types, expression operators, and numbers.

Point your editor's grammar registration at that file for .intent files. In a VS Code extension, reference it in package.json:

"contributes": {
  "languages": [{ "id": "intent", "extensions": [".intent"] }],
  "grammars": [{
    "language": "intent",
    "scopeName": "source.intent",
    "path": "./syntaxes/intent.tmLanguage.json"
  }]
}

The library

startLspServer({ readable, writable }) is exported from @skillstech/intentlang if you want to embed the server (for example over a different transport or in a test). It is the same server the intent lsp command runs.