Tooling

Editor setup

The lttr language server in VS Code, Neovim and Zed. Problems as you type, quick fixes, completion, hover and go to definition, which server to run for a kit or a typed app, .lttr/schema.json, and a studio that follows your unsaved buffers.

lttr has a language server. Your editor runs it and talks to it over stdin and stdout, and you get the same checks as lttr lint and the studio, as you type, before you save:

  • Problems. Every error and warning, at its line and column. That includes a kit's own problems, shown in the kit file they are in, such as kit.yaml or a component's html.tmpl.
  • Quick fixes. A problem with a "did you mean" suggestion offers a fix, Replace with "otp_code", which edits the misspelt name in place.
  • Completion. In a template: component names after ::; attribute names, and binding names as :invoice=""; enum values; and data paths, segment by segment, in a merge tag ({{invoice.) or a binding's value (:invoice="invoice.). In a kit template: token and var names, and .Attrs fields.
  • Hover. On ::name, the component: its attributes, bindings, content rules and children. On a data path, in a merge tag or a binding's value, the path and its type, such as invoice.total → tutorial.Money.
  • Go to definition. From ::name to the component's component.yaml and html.tmpl. From token "…" or var "…" in a kit template to its key in kit.yaml. A kit that is embedded in a binary, not on disk, has nowhere to go.

The server rebuilds 150 ms after you stop typing. A template that stops compiling keeps its last good render in the studio, and its problems show at once.

Choose the server

There are two servers, because the lttr binary cannot know an app's own Go types. Loading such a kit with stand-in types would report a false error on every binding, so a typed app runs the server from its own program instead:

Your templatesRunProblemsCompletion, hover, definition
quiet, plain, or a kit directory with no Go typeslttr lspExactYes
An app whose kit binds its own Go typesemaildev lsp: your studio program's lsp subcommandExact, with the real typesYes, from the real types
That app's templates, opened under lttr lsp—NoneYes, from .lttr/schema.json

lttr lsp

Terminal
go install github.com/sulv-io/lttr/cmd/lttr@latest

Your editor starts lttr lsp; you don't run it yourself. What a file is checked against depends on -kit:

  • With -kit (quiet, plain or a kit directory, with -dir and -golden as for serve), every file belongs to that kit. A Markdown file outside its samples and outside the kit directory is compiled against it as untyped data. .lttr/schema.json is not read: a kit that binds Go types, named with -kit, fails to load and shows the hint below.
  • Without -kit, each file finds its own kit:
    • a file in a kit directory (the nearest one up holding kit.yaml) belongs to that kit, and so does any other Markdown file inside it;
    • a file that a .lttr/schema.json describes, in its kit or template directory, gets completion, hover and definition from it, and no problems;
    • any other file belongs to quiet, with -dir and -golden. Only Quiet's own templates are checked there: a README or a changelog gets no lttr problems.

Relative -kit, -dir and -golden paths are relative to the directory the editor starts the server in, so give absolute paths when you use them.

A kit that binds Go types fails to load under lttr lsp when no .lttr/schema.json describes it, or when you name it with -kit. Its problem, on kit.yaml, says what to do:

kit.yaml
types: "Invoice" is not registered; this kit binds Go types: run your app's studio program with the lsp subcommand (see Editor setup)

emaildev lsp

An app that runs the studio from Go, with studio.Options, has the language server too, as its lsp subcommand. Every file builds with the program's kit, Go types, loader and samples, unsaved buffers included, so its problems and completions are exact:

Terminal
$ go run ./examples/tutorial/cmd/emaildev lsp -h
usage: emaildev lsp [-studio host:port] [-golden dir] [-editor name] [-send-to addr,…]

Runs the lttr language server for an editor, on stdin and stdout, until
the editor tells it to exit. Every file it opens builds with this
program's kit, Go types and samples, unsaved buffers included, so its
problems and completions are exact. A change to Go data or Go types
needs a restart.

With -studio, it also serves the studio on host:port, on the same
engine, so the preview follows the buffers as you type. If the studio
cannot start, the editor shows why and the language server runs on.

Stdout carries the protocol alone; logs, and the studio's serving line,
go to stderr.

flags:
  -editor editor
        editor that the studio's problem links open: vscode, cursor, zed, idea or none (default "vscode")
  -golden dir
        golden dir (<Name>.html and <Name>.txt) for the studio's golden status; empty for none (default "examples/tutorial/testdata")
  -send-to addresses
        addresses the studio's test sends may go to, comma-separated (else LTTR_STUDIO_SEND_TO); SMTP from LTTR_SMTP_ADDR, _USER, _PASS and _FROM
  -studio host:port
        also serve the studio on host:port, following the editor's buffers

KitDir and TemplateDir are relative to the working directory, so the editor must start it in the module root, as you run the studio. After a change to Go code, restart the language server from your editor.

Describe a typed app in schema.json

.lttr/schema.json describes a typed app's kit and data for editors that run plain lttr lsp. It holds:

  • version (1) and generator, the lttr version that wrote it;
  • kit: its name, its directory, its default component, and every component with its attributes, bindings and content rules, the tokens, the vars, the span classes and the frontmatter keys;
  • templateDir, and for each template its file, its name, the Go type of its data, and every merge-tag path with its type.

Paths in it are slash-separated and relative to the module root. Your studio program writes it with its schema subcommand:

Terminal
$ go run ./examples/tutorial/cmd/emaildev schema -h
usage: emaildev schema [-o file]

Writes .lttr/schema.json at the module root (the nearest directory up from here
holding go.mod): the kit's components, tokens and vars, and the data
paths of each template, for editors. Run it again after changing the
kit or the Go data types.

flags:
  -o file
        write to file instead of <module root>/.lttr/schema.json

The module root is the nearest directory up from the working directory that holds go.mod, else the working directory. Commit the file, and write it again after a change to the kit or to the Go data types. Without -kit, lttr lsp finds the nearest .lttr/schema.json that describes the file and reads it again whenever it changes, so there is nothing to restart. It gives completion, hover and definition to the files in the kit directory and the template directory the file names, and never publishes problems for them: only emaildev lsp knows the real types.

A file of another version is passed over, and the language server's log says why: schema.json version 2; regenerate it with your studio program's schema subcommand.

In the lttr repository, make schema writes the tutorial's .lttr/schema.json, and TestSchemaFresh in examples/tutorial fails when the committed file is out of date. It ignores generator, so a release that bumps the version doesn't make the file stale.

Preview as you type

-studio host:port serves the studio from the language server itself, on the same engine, so the preview follows the text in your editor before you save it:

Terminal
lttr lsp -studio localhost:7070
lttr lsp -kit ./kit -studio localhost:7070
go run ./examples/tutorial/cmd/emaildev lsp -studio localhost:7070

Put the flag in your editor's command, then open the address in a browser. The studio's serving line, lttr studio: serving kit (2 samples) on http://localhost:7070, goes to the server's stderr, which most editors keep in a log.

  • Which kit it serves. With -kit, that kit. Without it, the kit directory at or above the working directory, else quiet. emaildev lsp -studio serves the app's sample set.
  • Unsaved text. While the page shows a render of an unsaved buffer, the pill reads Live · unsaved buffer, and a render that differs from its golden says Δ differs from golden · unsaved. Save, and the pill returns to Live · watching …. Close the file without saving, and the preview returns to the text on disk.
  • New files. A file that exists only in your editor, never saved, can be read by the kit, but it isn't listed as a new sample until you save it.
  • Writes use the files on disk. Accept is off while the render uses unsaved text, and the Diff tab says This render uses unsaved editor text; save it first. Save to samples.yaml refuses while samples.yaml itself has unsaved changes in your editor: samples.yaml has unsaved changes in your editor; save it first. A golden, or a saved data edit, never holds text you haven't saved.
  • A typed kit. lttr lsp -studio started inside a kit directory that .lttr/schema.json describes serves no studio. The editor shows lttr studio: this kit binds Go types: run your app's studio program with lsp -studio, and the language server runs on.
  • A busy port. If the studio cannot start, the editor shows why, such as lttr studio: listen tcp 127.0.0.1:7070: bind: address already in use, and the language server runs on.
  • -editor and -send-to work as for serve, and are checked only with -studio: a bad LTTR_SMTP_ADDR never stops the language server itself.

The studio shows no "Rendering…" cue while a buffer rebuilds. At a 150 ms debounce and a build of about 40 ms, it would flicker on every keystroke. The pill and the ● updated cue already say that the preview follows the buffer.

VS Code

VS Code needs an extension to run a language server it doesn't know. Generic LSP Client (v2), extension ID zsol.vscode-glspc, runs any server from your settings. These steps were checked against its version 0.2.1:

Terminal
code --install-extension zsol.vscode-glspc

Then, in the workspace's settings:

.vscode/settings.json
{
  "glspc.server.command": "lttr",
  "glspc.server.commandArguments": ["lsp"],
  "glspc.server.languageId": ["markdown"]
}

For a typed app, run its studio program instead:

.vscode/settings.json
{
  "glspc.server.command": "go",
  "glspc.server.commandArguments": ["run", "./examples/tutorial/cmd/emaildev", "lsp"],
  "glspc.server.languageId": ["markdown"]
}
  • Open the module root. The extension starts the server in the window's first workspace folder, which is where emaildev lsp needs to run.
  • One server per window. The extension runs one server, so a window uses either lttr lsp or emaildev lsp.
  • Restarts. A change to these settings restarts the server. Generic LSP Client: Restart server in the command palette does it by hand, after a Go change, say.
  • Kit files. A kit's problems show in the Problems panel whatever the list says. For completion inside kit files too, add their language IDs to glspc.server.languageId: yaml for kit.yaml and component.yaml, and for html.tmpl the ID the Change Language Mode picker shows. A file whose extension VS Code doesn't know is plaintext.
  • Troubleshooting. The server's log is in the Generic LSP Client output channel. "glspc.trace.server": "verbose" adds every message. If the server doesn't start, give glspc.server.command the absolute path of lttr, such as the output of command -v lttr.

Add -studio to the arguments to preview as you type: ["lsp", "-studio", "localhost:7070"].

Neovim

Neovim has an LSP client built in. On Neovim 0.11 and later, define the server with vim.lsp.config and turn it on with vim.lsp.enable:

init.lua
vim.lsp.config('lttr', {
  cmd = { 'lttr', 'lsp' },
  filetypes = { 'markdown' },
  root_markers = { 'go.mod', '.git' },
})
vim.lsp.enable('lttr')

For a typed app, start its studio program in the module root with cmd_cwd:

init.lua
vim.lsp.config('emaildev', {
  cmd = { 'go', 'run', './examples/tutorial/cmd/emaildev', 'lsp' },
  cmd_cwd = '/path/to/your/module',
  filetypes = { 'markdown' },
  root_markers = { 'go.mod' },
})
vim.lsp.enable('emaildev')

Enable one of the two per project, not both, or every Markdown file gets two servers.

On Neovim 0.10, start the server from a FileType autocommand with vim.lsp.start:

init.lua
vim.api.nvim_create_autocmd('FileType', {
  pattern = 'markdown',
  callback = function(ev)
    vim.lsp.start({
      name = 'lttr',
      cmd = { 'lttr', 'lsp' },
      root_dir = vim.fs.root(ev.buf, { 'go.mod', '.git' }),
    })
  end,
})

vim.fs.root is new in 0.10. On 0.8 and 0.9, write root_dir = vim.fs.dirname(vim.fs.find({ 'go.mod', '.git' }, { upward = true })[1]) instead.

  • Check it attached with :checkhealth vim.lsp (:checkhealth lsp before 0.11).
  • Use it. K hovers by default in Neovim 0.10+; on earlier versions, map vim.lsp.buf.hover(). The other defaults: CTRL-] goes to the definition, and CTRL-X CTRL-O completes in insert mode. On 0.11, gra opens the code actions, where the quick fixes are; on earlier versions, map vim.lsp.buf.code_action() yourself. Problems show as diagnostics.
  • Kit files. For completion in kit templates, add the filetype Neovim gives them to filetypes (:set filetype? in one shows it), and yaml for kit.yaml.
  • The working directory is Neovim's own unless you set cmd_cwd. It matters for emaildev lsp, for relative -kit and -dir paths, and for -studio without -kit.

Add -studio to cmd to preview as you type: cmd = { 'lttr', 'lsp', '-studio', 'localhost:7070' }.

Zed

Zed needs an extension. It starts only language servers that Zed itself or an extension registers, and its settings cannot add a new one: an lsp entry for a name no extension registers is not allowed. Zed's own extension docs say a language server needs a few lines of Rust, and a Zed maintainer confirmed in April 2026 that settings alone won't do (zed-industries/zed issue #52653). There is no published lttr extension.

The shortest route is a local dev extension of three files. It needs Rust installed with rustup, which lets Zed add the wasm32-wasip2 target it builds extensions for.

extension.toml
id = "lttr-lsp"
name = "lttr language server"
version = "0.0.1"
schema_version = 1
authors = ["You <you@example.com>"]
description = "Runs lttr lsp for Markdown"
repository = "https://github.com/you/zed-lttr-lsp"

[language_servers.lttr]
name = "lttr"
languages = ["Markdown"]
Cargo.toml
[package]
name = "lttr-lsp"
version = "0.0.1"
edition = "2021"

[lib]
crate-type = ["cdylib"]

[dependencies]
zed_extension_api = "0.7.0"
src/lib.rs
use zed_extension_api::{self as zed, settings::LspSettings};

struct LttrExtension;

impl zed::Extension for LttrExtension {
    fn new() -> Self {
        LttrExtension
    }

    // Starts `lttr lsp`, or the command in the "lsp" → "lttr" → "binary"
    // setting: an app's own studio program, for example.
    fn language_server_command(
        &mut self,
        id: &zed::LanguageServerId,
        worktree: &zed::Worktree,
    ) -> zed::Result<zed::Command> {
        let binary = LspSettings::for_worktree(id.as_ref(), worktree)
            .ok()
            .and_then(|s| s.binary);
        let command = binary
            .as_ref()
            .and_then(|b| b.path.clone())
            .or_else(|| worktree.which("lttr"))
            .ok_or("lttr is not on your PATH: go install github.com/sulv-io/lttr/cmd/lttr@latest")?;
        let args = binary
            .as_ref()
            .and_then(|b| b.arguments.clone())
            .unwrap_or_else(|| vec!["lsp".into()]);
        let env = binary
            .and_then(|b| b.env)
            .map(|e| e.into_iter().collect())
            .unwrap_or_default();
        Ok(zed::Command { command, args, env })
    }
}

zed::register_extension!(LttrExtension);

Put the three files in one directory, then run zed: install dev extension from the command palette (or Install Dev Extension on the Extensions page) and pick that directory. Open a Markdown file, and the server starts. Zed's log (zed: open log) shows why if it doesn't.

With the extension in place, Zed's lsp setting passes other arguments, or another program:

settings.json
{
  "lsp": {
    "lttr": {
      "binary": {
        "arguments": ["lsp", "-studio", "localhost:7070"]
      }
    }
  }
}

Zed doesn't document the working directory it starts a server in, so start a typed app's program through a shell that changes to the module root first:

settings.json
{
  "lsp": {
    "lttr": {
      "binary": {
        "path": "/bin/sh",
        "arguments": ["-c", "cd /path/to/your/module && exec go run ./examples/tutorial/cmd/emaildev lsp"]
      }
    }
  }
}

The extension above builds against zed_extension_api 0.7.0, the latest release when this page was written. Markdown in Zed has no language server of its own, so nothing else competes for these files.

Next steps

Copyright © 2026