Language servers (LSP)
The LSP tool connects the agent to language servers, the same ones your IDE uses: rust-analyzer, gopls, pyright, and others. Grep finds matching lines; a language server answers questions about symbols.
Why it is more precise than search
Section titled “Why it is more precise than search”| Question | With text search | With a language server |
|---|---|---|
Where is save defined | Dozens of matches: methods of different classes, strings, comments | One place, for this exact symbol |
| Who calls this function | Matches by name, including functions with the same name in other modules | Calls to this exact function |
| What does this expression return | No answer | The type, as the compiler sees it |
| What will a rename break | No answer | The list of places that have to change |
| Is the edit correct | Only after you run the build | Errors arrive right after the file is written |
After every write through Write or Edit, the agent briefly waits for the server’s response, and new errors come back with the result of the edit. The agent fixes a typo in a name, a type mismatch, or a missing import in the same turn, without running the compiler. While the server is starting and indexing the project, edits are not checked, and the result says so.
Exact symbol locations save the agent from reading a dozen files to find the right place; see Context window.
What the tool does
Section titled “What the tool does”- diagnostics for a file;
- go to definition, to type definition, and to implementation;
- find references;
- hover with the type and documentation;
- the list of symbols in a file and a symbol search across the whole project;
- rename preview: the tool shows the edits, and the agent applies them with
Edit; - code actions;
- server status and restart.
LSP only reads and never changes anything itself, so it does not ask for approval. The language server itself runs outside the sandbox, with your permissions. A symbol query waits a limited time for the project to finish indexing, and the agent can extend that time.
Turning it on
Section titled “Turning it on”A server starts on its own when two conditions are met: its program is installed, and the project root has the language’s marker file. The project root is the root of the git repository or, outside a repository, the directory where the agent was started. The program is looked up in PATH, and in a trusted folder first in the project directories node_modules/.bin, .venv/bin, venv/bin, .venv/Scripts, venv/Scripts (the layout of a Python virtual environment on Windows), .tools/bin, and bin.
| Language | Server | Marker in the root | Installation |
|---|---|---|---|
| Rust | rust-analyzer | Cargo.toml | rustup component add rust-analyzer or brew install rust-analyzer |
| Go | gopls | go.mod, go.work | go install golang.org/x/tools/gopls@latest |
| Python | pyright | pyproject.toml, setup.py, setup.cfg, requirements.txt, .venv | npm i -g pyright or pip install pyright |
| TypeScript, JavaScript | typescript-language-server | tsconfig.json, jsconfig.json, package.json | npm i -g typescript-language-server typescript |
| C, C++ | clangd | compile_commands.json, compile_flags.txt, CMakeLists.txt | brew install llvm, apt install clangd, or winget install LLVM.LLVM |
| Lua | lua-language-server | .luarc.json, *.rockspec | brew install lua-language-server or winget install LuaLS.lua-language-server |
Other servers are not supported: there is no setting for your own list of servers. /lsp shows the servers whose marker was found and, for each one, whether it is ready, and if not, the install command for this machine.
If no server is ready, the LSP tool is not in the agent’s list, and the agent searches with Grep. Readiness is checked once per Waibee Code launch, so a server you install while working shows up after a restart.
Servers start on the first LSP call or on the first edit of a file in a language that has a server. To start them together with the session, turn on lsp.prewarm; see the Settings reference.
Using it
Section titled “Using it”Usually the agent queries the server on its own. Asking directly helps where it would otherwise reach for grep:
- “use
LSPto find all references toPaymentProviderand show where the interface is implemented”. - “show what breaks if
parseConfigis renamed toloadConfig: preview first, then we decide”. - “after the edit, run diagnostics on the changed files and fix only the new errors”.
On an unfamiliar project, check /lsp at the start of the session: if the server is not installed, the agent searches by text only.
Where it won’t help
Section titled “Where it won’t help”- The language is not in the table:
GrepandGlobremain. For a map of the definitions in a file, use the sameGrepincontentmode with a pattern like^\s*(pub |export |async )*(fn|class|def|struct|type)\b. - A monorepo where the language marker sits only in a subdirectory (
backend/go.mod): edits in that language are not checked. If the root has no marker at all, there is noLSPtool. - Untyped dynamic code: the value is built at runtime, so the server has nothing to resolve.
- Templates, configs, migrations: text search fits better there.
- Large projects: the first indexing takes time, and rust-analyzer and pyright use a lot of memory on them.