Skip to content
docs

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.

QuestionWith text searchWith a language server
Where is save definedDozens of matches: methods of different classes, strings, commentsOne place, for this exact symbol
Who calls this functionMatches by name, including functions with the same name in other modulesCalls to this exact function
What does this expression returnNo answerThe type, as the compiler sees it
What will a rename breakNo answerThe list of places that have to change
Is the edit correctOnly after you run the buildErrors 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.

  • 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.

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.

LanguageServerMarker in the rootInstallation
Rustrust-analyzerCargo.tomlrustup component add rust-analyzer or brew install rust-analyzer
Gogoplsgo.mod, go.workgo install golang.org/x/tools/gopls@latest
Pythonpyrightpyproject.toml, setup.py, setup.cfg, requirements.txt, .venvnpm i -g pyright or pip install pyright
TypeScript, JavaScripttypescript-language-servertsconfig.json, jsconfig.json, package.jsonnpm i -g typescript-language-server typescript
C, C++clangdcompile_commands.json, compile_flags.txt, CMakeLists.txtbrew install llvm, apt install clangd, or winget install LLVM.LLVM
Lualua-language-server.luarc.json, *.rockspecbrew 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.

Usually the agent queries the server on its own. Asking directly helps where it would otherwise reach for grep:

  • “use LSP to find all references to PaymentProvider and show where the interface is implemented”.
  • “show what breaks if parseConfig is renamed to loadConfig: 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.

  • The language is not in the table: Grep and Glob remain. For a map of the definitions in a file, use the same Grep in content mode 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 no LSP tool.
  • 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.