Quick Start
1
Let the agent do it (nothing to configure)
2
Detect language and root yourself (advanced)
3
Probe availability before you use LSP
4
Talk to the client directly with a workspace-aware root
How It Works
Each language maps to a default server, its file extensions, and the root markers that pin a project root — the nearest marker wins.Which Helper Should I Use?
Public API Surface
These are pure helpers plus one new keyword and one new attribute onLSPClient.
Common Patterns
Guarded startup logging — log what the LSP layer would do for each language:client.last_error so the model picks a fallback intelligently:
Best Practices
Prefer probe() over try/except
Prefer probe() over try/except
LSPClient.start() no longer raises on a missing binary — it sets last_error and returns False. Reserve try/except for real IO failures.Pass workspace_file= to LSPClient in monorepos
Pass workspace_file= to LSPClient in monorepos
Without it, the client falls back to
os.getcwd(), which is almost never the file’s real project root. workspace_file lets detect_root_uri initialise the server against the nearest root marker.Do not parse the phrases
Do not parse the phrases
Error text like
install with \…`is for humans. For machine-readable data, callprobe(language)and read the(available, command, install_hint)` tuple.Treat the 'not found on PATH' note as a call to action
Treat the 'not found on PATH' note as a call to action
The
edit_tools note appears once per language per run. When you see it, install the server rather than ignore the diagnostic signal for the rest of the session.Related
LSP Navigation Tools
Go-to-definition, find-references, hover, and symbol search
LSP Tools (reference)
Per-tool parameters and output format
Post-Edit Formatter
Produces the new “diagnostics unavailable” note
Built-in Tool Registry
How
Agent(tools=[…]) resolves tool names
