# LSP guide
Manages language servers and collects diagnostics after document edits.
## Where to look
| Shared types and limits | `mod.rs` |
| Server reuse, failure isolation, idle shutdown | `manager.rs` |
| Initialization, document sync, fresh diagnostics | `client.rs` |
| Framed process transport | `stdio.rs` |
| Language routing and document versions | `sync.rs` |
| Diagnostic freshness and injection format | `diagnostics.rs` |
## Local rules
- Reuse configured workspace/server routing; diagnostics cannot expand editing-tool file access.
- Preserve document versions for full-document synchronization. Versioned diagnostics must meet the requested version; unversioned diagnostics must arrive after synchronization started.
- Inject selected errors/warnings only through existing count/byte limits and the redaction formatter.
- Keep initialization/request waits and cancellation in the blocking transport/client path, never the UI thread.
- Preserve idle shutdown and repeated-failure disabling. Unavailable servers are not successful clean diagnostic checks.
- LSP uses Content-Length framing, unlike MCP newline-delimited stdio. Shutdown must release child processes.