@mrclrchtr/supi-lsp
v1.10.0
Published
SuPi LSP extension — Language Server Protocol integration for pi
Maintainers
Readme
@mrclrchtr/supi-lsp
Adds Language Server Protocol support to the pi coding agent.
Install
pi install npm:@mrclrchtr/supi-lspFor local development:
pi install ./packages/supi-lspWhat you get
After install, pi gets 10 focused expert tools for semantic language-server analysis:
lsp_hover— semantic type or symbol information at a given positionlsp_definition— go to definition at a known positionlsp_references— find all references to a symbollsp_implementation— find implementations of an interface or methodlsp_document_symbols— semantic declarations for one supported filelsp_workspace_symbols— semantic symbol-name lookup across the projectlsp_diagnostics— current diagnostics for one file or a workspace summarylsp_rename— semantic rename planning at a known positionlsp_code_actions— semantic fixes or refactors at a known positionlsp_recover— refresh stale diagnostics after workspace changes/lsp-status— inspect detected servers, roots, open files, and diagnostics


Coordinates use 1-based line and character positions.
Automatic behavior
This package does more than register these tools:
- starts detected language servers for the current project
- rebuilds project-specific prompt guidance based on active servers
- injects outstanding diagnostics into context before agent turns when issues exist
- adds inline diagnostics after
writeandeditresults - watches for workspace changes such as
package.json, lockfile,tsconfig, generated types, and source-file edits so recovery can happen when diagnostics go stale - warns when configured language-server commands are missing
Settings
This package registers an LSP section in /supi-settings.
Available settings:
enabled— turn all LSP behavior on or offseverity— inline diagnostic threshold:1errors,2warnings,3info,4hintsactive— choose which configured language servers are active; empty means allexclude— gitignore-style patterns that suppress diagnostics for matching files
Config lives in the standard SuPi config files:
- global:
~/.pi/agent/supi/config.json - project:
.pi/supi/config.json
Architecture
@mrclrchtr/supi-lsp is the semantic substrate in SuPi's code-understanding stack.
It depends on @mrclrchtr/supi-core and @mrclrchtr/supi-code-runtime for shared
contracts, and provides a session-scoped LSP service that publishes semantic and
diagnostic capabilities into the shared workspace runtime.
supi-code-runtime ← shared contracts + workspace runtime
↑
supi-lsp ← LSP client + session-scoped service + runtime capabilitiesPackage surfaces
@mrclrchtr/supi-lsp/api— reusable session-scoped LSP service and related types@mrclrchtr/supi-lsp/extension— pi extension entrypoint@mrclrchtr/supi-lsp/provider/lsp-semantic-provider— shared SemanticProvider adapter
Example:
import { getSessionLspService, toLspPosition } from "@mrclrchtr/supi-lsp/api";
const state = getSessionLspService("/project");
if (state.kind === "ready") {
const defs = await state.service.definition("src/index.ts", toLspPosition(6, 11));
}SessionLspService methods use raw 0-based LSP positions. The expert tools (lsp_hover, lsp_definition, etc.) keep the public 1-based coordinate UX.
Source
src/lsp.ts— extension wiring, session lifecycle, and/lsp-statussrc/config/— server config, defaults, capabilities, and exported LSP protocol typessrc/session/— session state, scanning, settings registration, tree persistence, and shared service registrysrc/tool/tool-specs.ts— single source of truth for the public LSP tool surfacesrc/tool/guidance.ts— prompt surfaces derived from tool specssrc/tool/register-tools.ts— focused tool registration driven by tool specssrc/tool/service-actions.ts— service-backed tool execution and formattingsrc/tool/names.ts— stable tool name constantssrc/tool/overrides.ts— read/write/edit overrides for inline diagnosticssrc/ui/— custom diagnostic message rendering and the status overlaysrc/client/,src/manager/,src/diagnostics/— runtime engine subsystemssrc/api.ts— reusable developer-facing surface
