Editor language server (wtctl lsp)

Embed
Preview of the card
<a href="https://forumulate.com/p/watchtower/docs/lsp"><img src="https://forumulate.com/api/public/orgs/watchtower/spaces/docs/pages/c428a2a1-b3f2-45f7-a953-c0d80c5b5e20/social-card.svg?v=3e7ae33eec8b" alt="Editor language server (wtctl lsp)" width="600" height="315"></a>

Shows production latency and errors above functions, with a hover for the latest issue and a trace link. Speaks LSP 3.17 over stdio.

Setup

Environment: WT_API_URL, WT_API_KEY (read scope), optional WT_WEB_URL (links; defaults to the API URL), optional WT_PROJECT (overrides project).

Repo root watchtower.yaml:

service: checkout
project: prj_...
path_prefixes: [services/checkout]   # empty = whole repo

Behaviour

  • textDocument/codeLens: "p95 120 ms · 4 errors/24h" above functions of files that map to the service. Unmapped files get no lens.

  • textDocument/hover on a function line: latest issue and slowest trace links.

  • workspace/executeCommand watchtower.openIssue / watchtower.openTrace with [project, id] returns a URL for the client to open.

  • Data comes from GET /v1/projects/{p}/code-stats (spans with code.filepath and code.function, plus error-event frames), cached 60 s server side.

  • Privacy: only the service, file path and function names are sent. Source text never leaves the machine.

  • Function discovery is one regex per language (go, rs, ts/js, py, java, cs). Tree-sitter is a later improvement.

  • Spans need code.filepath and code.function attributes (OTel semconv) to show up.

Updated