feat: add lsp_references tool for symbol references via LSP #32
Merged
FO
4mo ago+1288+1288+0123456789012345678901234567890123456789-0-0-0123456789
Closes #32
Summary by cubic
Adds the lsp_references tool to find symbol references via LSP and expose it in the supertools plugin. Ships a minimal LSP client and registry with default servers; fixes Content‑Length byte handling and path output; requires an installed language server. Meets #32.
-
New Features
lsp_references: finds references for a file and 1‑based position; returns relative paths and 1‑based positions; supportsmax_resultswith a truncation hint; clear hints when no server or file is missing.LspClient: JSON‑RPC 2.0 over stdio with Content‑Length framing; initialize/hover/references, diagnostics cache, timeouts, and graceful shutdown.LspRegistry: maps extensions to servers, checks install viawhich, spawns/reuses clients; defaults fortypescript-language-server,gopls,pyright-langserver,rust-analyzer,intelephense.- Plugin registers
lsp_references.
-
Bug Fixes
- Tool returns
ToolResult‑compatible JSON strings; removed invalidpermission; fixedlsp-client.tsstdin/stdout casts; added missing globals ineslint.config.js. - Correct
Content-Lengthuses byte length; reference paths now usenode:pathrelative(prefixed with./when appropriate); tests parse JSON and clean up registry/processes and temp dirs. - Removed references to non‑existent
lsp_hoverandlsp_diagnostics; plugin also registersgh_bot_review.
- Tool returns
Summary by CodeRabbit
Release Notes
- New Features
- Added LSP-backed capabilities for hover, diagnostics, document symbols, and cross-file symbol references.
- Introduced automatic language-server selection based on file extension and installation status.
- Exposed a new LSP references tool with truncation and helpful “server not available” messaging.
- Tests
- Added end-to-end tests with mock LSP servers covering availability, missing files, default parameters, empty results, and truncation behavior.
- Chores
- Updated ESLint globals for additional runtime/browser-related built-ins.