Skip to main content
The /lsp <file> command pulls the real diagnostics for a code file β€” the same errors and warnings your editor would show β€” by starting the appropriate language server and speaking the Language Server Protocol with it.
It’s a manual, per-file command: you pass a file, ChatCLI starts the language server for its language, opens the document, waits for diagnostics and prints them. There is no automatic injection into /agent//coder.

How it works

/lsp ./cli/agent_mode.go
     β”‚
     β–Ό
detect language by extension (.go β†’ gopls)
     β”‚
     β–Ό
start the language server (stdio, JSON-RPC with Content-Length framing)
     β”‚
     β–Ό
initialize β†’ didOpen(file) β†’ wait for publishDiagnostics (up to 12s)
     β”‚
     β–Ό
print errors/warnings (or "No problems found")
  1. Language detection β€” by file extension.
  2. Spawn β€” starts the language’s server (default command or your override). If the binary isn’t installed/on PATH, /lsp says so.
  3. Handshake β€” initialize + textDocument/didOpen.
  4. Diagnostics β€” waits up to 12s for textDocument/publishDiagnostics and renders the result.

Languages and default commands

Each language uses a conventional stdio command, overridable via an environment variable. The binary must be installed and on PATH.
ExtensionsLanguage server (default)Override
.gogoplsCHATCLI_LSP_GO_CMD
.pypyright-langserver --stdioCHATCLI_LSP_PYTHON_CMD
.ts .tsx .js .jsxtypescript-language-server --stdioCHATCLI_LSP_TS_CMD
.rsrust-analyzerCHATCLI_LSP_RUST_CMD
.c .hclangdCHATCLI_LSP_C_CMD
.cpp .ccclangdCHATCLI_LSP_CPP_CMD
.javajdtlsCHATCLI_LSP_JAVA_CMD
.rbsolargraph stdioCHATCLI_LSP_RUBY_CMD
# Example: enable gopls trace or point at a different binary
export CHATCLI_LSP_GO_CMD="gopls -rpc.trace"
export CHATCLI_LSP_PYTHON_CMD="pyright-langserver --stdio"

Usage

> /lsp ./cli/agent_mode.go
  Starting language server: gopls...

  Diagnostics for agent_mode.go
  ─────────────────────────────────────────
  No problems found.
> /lsp ./broken.go
  Starting language server: gopls...

  Diagnostics for broken.go
  ─────────────────────────────────────────
  error  12:6   undefined: fmt.Printline
  warn   30:2   declared and not used: x
Pair it with /coder: run /lsp on a file you just edited to confirm you didn’t introduce compile errors before moving on.

See also