LSP client: spawn language servers, expose code intelligence tools

New lsp.rs: LspRegistry manages persistent LSP server connections.
Spawns child processes, speaks LSP protocol (Content-Length framed
JSON-RPC over stdio). Server indexes the project once; queries are
cheap.

Tools: lsp_definition, lsp_references, lsp_hover, lsp_symbols,
lsp_callers. Each takes file/line/character, queries the running
language server.

LspRegistry lives on Agent as Option<Arc>, shared across forks.
Still needs: config-driven server startup (like MCP).

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-09 12:07:50 -04:00
parent 8b5614ba99
commit 6ec0e1c766
3 changed files with 437 additions and 0 deletions

View file

@ -6,6 +6,7 @@
// Core tools
mod ast_grep;
pub mod lsp;
pub mod mcp_client;
mod bash;
pub mod channels;
@ -184,6 +185,7 @@ pub fn tools() -> Vec<Tool> {
all.extend(memory::journal_tools());
all.extend(channels::tools());
all.extend(control::tools());
all.extend(lsp::tools());
all
}