@spences10/pi-lsp
Pi extension that exposes Language Server Protocol diagnostics, hover, definition, and reference tools
Package details
Install @spences10/pi-lsp from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@spences10/pi-lsp- Package
@spences10/pi-lsp- Version
0.0.14- Published
- May 4, 2026
- Downloads
- 1,690/mo · 1,632/wk
- Author
- spences10
- License
- MIT
- Types
- extension
- Size
- 124.2 KB
- Dependencies
- 5 dependencies · 0 peers
Pi manifest JSON
{
"extensions": [
"./dist/index.js"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@spences10/pi-lsp
Pi extension that exposes Language Server Protocol diagnostics, hover, definitions, references, and document symbols to the model.
Maintained in the my-pi Vite+ workspace and tested with Vitest.
Installation
pi install npm:@spences10/pi-lsp
Local development from this monorepo:
pnpm --filter @spences10/pi-lsp run build
pi install ./packages/pi-lsp
# or for one run only
pi -e ./packages/pi-lsp
Required language servers
This package talks to language-server binaries installed in your
project or on PATH. For TypeScript, JavaScript, and Svelte projects:
pnpm add -D typescript typescript-language-server svelte-language-server
Supported server discovery includes:
- TypeScript / JavaScript via
typescript-language-server - Svelte via
svelteserver - Python via
python-lsp-server - Go via
gopls - Rust via
rust-analyzer - Ruby via
solargraph - Java via
jdtls - Lua via
lua-language-server
Project-local binaries in node_modules/.bin are detected before
global binaries, but are untrusted by default because they can execute
repo-controlled code. Interactive sessions prompt before starting a
project-local binary; headless sessions fall back to the global PATH
binary unless MY_PI_LSP_PROJECT_BINARY=allow or
MY_PI_LSP_PROJECT_BINARY=trust is set. /lsp status shows the
resolved binary path for running and idle servers.
Language servers receive a restricted child-process environment by
default. Use MY_PI_LSP_ENV_ALLOWLIST=NAME,OTHER_NAME or the shared
MY_PI_CHILD_ENV_ALLOWLIST to pass selected ambient variables
through.
Tools
The extension registers LSP-backed Pi tools for:
- diagnostics
- hover
- definitions
- references
- document symbols
These tools let the model inspect types, find usages, and catch diagnostics without guessing from text search alone.
Model reminder
When LSP tools are active, the extension injects a small system prompt
reminder telling the model to use LSP for focused diagnostics, type
and symbol questions, definitions, references, and validation before
reporting completion. It also reminds the model to run diagnostics on
changed language-server-supported files before completion or commit,
preferring lsp_diagnostics_many for batches.
Commands
/lsp status
/lsp list
/lsp restart all
/lsp restart <language>
Use /lsp status to inspect active clients and /lsp restart after
dependency installs or language-server crashes.
Using from a custom harness
import lsp from '@spences10/pi-lsp';
// pass `lsp` as an ExtensionFactory to your Pi runtime
my-pi imports this package directly and enables it as the built-in
LSP extension.
Development
pnpm --filter @spences10/pi-lsp run check
pnpm --filter @spences10/pi-lsp run test
pnpm --filter @spences10/pi-lsp run build
License
MIT