pi-diet-lsp
On-demand LSP code-intelligence tools for Pi without automatic diagnostics or context injection.
Package details
Install pi-diet-lsp from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-diet-lsp- Package
pi-diet-lsp- Version
0.1.10- Published
- Nov 5, 2026
- Downloads
- 363/mo · 66/wk
- Author
- probabilityengineer
- License
- MIT
- Types
- extension
- Size
- 42.6 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-diet-lsp
One of my diet context engineering and workflow extensions. Explore the complete collection: https://www.npmjs.com/~probabilityengineer
On-demand LSP code-intelligence tools for Pi without automatic diagnostics or context injection.
pi-diet-lsp gives Pi agents focused, model-visible Language Server Protocol tools for definitions, references, symbols, hover/type information, and diagnostics. It keeps the surface compact and explicit: no automatic diagnostics pipeline, no context injection, no read guard, no skills, and no session-start bootstrap. Agents call the tools when precise code intelligence is useful.
This is intentionally different from automatic LSP feedback extensions: pi-diet-lsp favors low prompt overhead and explicit tool calls over continuously appending diagnostics to every edit.
Tools
lsp_definition— jump to definition at a 1-based file positionlsp_references— find references at a 1-based file positionlsp_symbols— document symbols for a file, or workspace symbols by querylsp_hover— show hover/type info at a 1-based file positionlsp_diagnostics— open a file in LSP and return current diagnostics
lsp_symbols has two modes:
{ "filePath": "src/index.ts", "query": "optional-filter" }
{ "query": "SymbolName" }
With filePath, it returns document symbols. Without filePath, it uses LSP workspace symbol search.
Large symbol/reference results are compacted and capped to avoid runaway context growth.
Use /lsp to toggle pi-diet-lsp tools, and /lsp-footer to toggle the footer entry. Both commands are toggle-only and take no arguments.
Install
From npm, after publication:
pi install npm:pi-diet-lsp
From GitHub:
pi install git:github.com/ProbabilityEngineer/pi-diet-lsp
For project-local install, add -l:
pi install -l git:github.com/ProbabilityEngineer/pi-diet-lsp
For local testing:
pi -e ./index.ts
Runtime requirements
LSP tools resolve language servers from PATH using broader built-in defaults and first-available selection when multiple servers are supported. Configured command values may also be absolute executable paths (with arguments supplied separately in args); absolute paths are checked directly, independently of PATH.
Availability checks require a regular file (or a symlink to one) and execute access on POSIX systems, so directories and non-executable files are skipped. These checks do not guarantee successful startup: interpreters, shared libraries, runtime configuration, and Windows executable-format restrictions can still prevent launch.
Current built-in mappings include:
- TypeScript/JavaScript:
typescript-language-server --stdio - Vue:
vue-language-server --stdio - Python:
basedpyright-langserver --stdio, fallbackpyright-langserver --stdio - Go:
gopls - Rust:
rust-analyzer - Swift:
sourcekit-lsp - C/C++:
clangd - C#:
csharp-ls, fallbackomnisharp --languageserver - Java:
jdtls - Kotlin:
kotlin-language-server - PHP:
intelephense --stdio, fallbackphpactor language-server - Ruby:
ruby-lsp, fallbacksolargraph stdio - Lua:
lua-language-server - Nix:
nixd, fallbacknil - HTML:
vscode-html-language-server --stdio - CSS/SCSS/Less:
vscode-css-language-server --stdio - JSON:
vscode-json-language-server --stdio - YAML:
yaml-language-server --stdio
Configuration overrides
You can override or add language mappings with:
~/.pi/agent/pi-diet-lsp/config.json
Example:
{
"showStatus": false,
"languages": {
"lua_override": {
"languageId": "lua",
"extensions": [".lua"],
"servers": [
{ "command": "custom-lua-lsp", "args": ["--stdio"] }
]
}
}
}
Configured languages are checked before built-in defaults.
You can also provide per-server environment variables, which is especially useful for OmniSharp:
{
"languages": {
"csharp_override": {
"languageId": "csharp",
"extensions": [".cs"],
"servers": [
{
"command": "omnisharp",
"args": ["--languageserver"],
"env": {
"DOTNET_ROOT": "/Users/you/.dotnet"
}
}
]
}
}
}
C# notes and troubleshooting
pi-diet-lsppreferscsharp-lsfirst, then falls back toomnisharp.- The selected executable must be runnable from
PATH, or configured with an absolute executable path. It is launched directly, without an interactive shell. - For OmniSharp,
pi-diet-lspnow auto-uses~/.dotnetasDOTNET_ROOTwhen present. If your setup differs, setenv.DOTNET_ROOTin config. - Legacy
.NET Frameworkprojects may still load with partial diagnostics on macOS/Linux if reference assemblies/targeting packs are unavailable. - If a server fails to launch, tool errors now include launch details and stderr instead of only reporting an initialize timeout.
Validation
npm run lint
npm run test:resolution
Prompt overhead
pi-diet-lsp avoids automatic context injection. It registers compact tools and guidance, then waits for agents to call LSP tools explicitly when code intelligence is relevant.
Guidance covers only this extension's LSP tools; it does not assume other extensions are installed.