@narumitw/pi-lsp
v0.1.26
Published
Pi extension that exposes language-server tools for Biome, ty, and Ruff through a shared LSP runner.
Maintainers
Readme
🧠 pi-lsp — Shared Language Server Tools for Pi
@narumitw/pi-lsp is a native Pi coding agent extension that exposes Biome, ty, and Ruff language-server tools through one shared LSP runner Module.
It supersedes the older split packages @narumitw/pi-biome-lsp and @narumitw/pi-python-lsp, which now live under extensions/deprecated/ and are excluded from active workspace scripts.
✨ Features
- Runs
biome lsp-proxyon demand for diagnostics, formatting, import organization, and source fixes. - Runs
ty serveron demand for Python type diagnostics. - Runs
ruff serveron demand for Python lint diagnostics, formatting, import organization, and source fixes. - Uses one internal LSP runner for JSON-RPC framing, subprocess lifecycle, diagnostics, formatting, code actions, and workspace edit application.
- Keeps Biome, ty, and Ruff behavior in small server Adapters.
- Supports workspace roots, file limits, recursive file discovery, and write-or-preview edits.
- Starts language servers only for tool calls, then shuts them down.
- Shows statusline activity only while LSP tools are running.
📦 Install
pi install npm:@narumitw/pi-lspTry without installing permanently:
pi -e npm:@narumitw/pi-lspTry this package locally from the repository root:
pi -e ./extensions/pi-lsp⚠️ Tool-name compatibility
This package intentionally registers the same tool names as @narumitw/pi-biome-lsp and @narumitw/pi-python-lsp:
biome_lsp_diagnosticsbiome_lsp_formatbiome_lsp_fixty_lsp_diagnosticsruff_lsp_diagnosticsruff_lsp_formatruff_lsp_fix
Avoid installing @narumitw/pi-lsp side by side with the older deprecated LSP packages unless you have verified how your Pi version handles duplicate tool names.
✅ Requirements
Install the language servers you want to use somewhere on PATH:
uv tool install ty
uv tool install ruffFor Biome, either install it globally/on PATH, add your project's node_modules/.bin to PATH, or point the extension at a project-local command. For example:
npm install -D @biomejs/biome
PI_BIOME_LSP_COMMAND="./node_modules/.bin/biome lsp-proxy" pi -e ./extensions/pi-lspOr provide custom server commands:
PI_BIOME_LSP_COMMAND="npx biome lsp-proxy" \
PI_TY_LSP_COMMAND="uvx ty server" \
PI_RUFF_LSP_COMMAND="uvx ruff server" \
pi -e ./extensions/pi-lspOptional timeout overrides:
PI_BIOME_LSP_TIMEOUT_MS=30000 \
PI_TY_LSP_TIMEOUT_MS=30000 \
PI_RUFF_LSP_TIMEOUT_MS=30000 \
pi -e ./extensions/pi-lsp🛠️ Pi tools
Biome
biome_lsp_diagnostics— startbiome lsp-proxy, open supported files, and return diagnostics.biome_lsp_format— compute or write formatting edits for one Biome-supported file.biome_lsp_fix— compute or write source actions such assource.fixAll.biomeorsource.organizeImports.biome.
Python
ty_lsp_diagnostics— startty server, open Python files, and return type diagnostics.ruff_lsp_diagnostics— startruff server, open Python files, and return lint diagnostics.ruff_lsp_format— compute or write Ruff formatting edits for one Python file.ruff_lsp_fix— compute or write Ruff source actions such assource.fixAll.rufforsource.organizeImports.ruff.
🚀 Examples
Check a project subset with Biome diagnostics:
{
"paths": ["src", "extensions/pi-lsp/src"],
"limit": 100
}Format a TypeScript file with Biome:
{
"path": "src/index.ts",
"write": true
}Check a Python project with ty or Ruff diagnostics:
{
"paths": ["src", "tests"],
"limit": 100
}Organize Python imports with Ruff:
{
"path": "src/app.py",
"kind": "source.organizeImports.ruff",
"write": true
}If paths is omitted for diagnostics, the tool recursively discovers supported files under the workspace root while skipping common generated, dependency, cache, and virtualenv directories.
💬 Command
/lspShows the configured Biome, ty, and Ruff LSP commands and whether each command is available on PATH.
🗂️ Package layout
extensions/pi-lsp/
├── src/
│ ├── adapters.ts
│ ├── command.ts
│ ├── files.ts
│ ├── lsp-client.ts
│ ├── pi-lsp.ts
│ ├── runner.ts
│ ├── text-edits.ts
│ └── types.ts
├── README.md
├── LICENSE
├── tsconfig.json
└── package.json🔎 Keywords
Pi extension, Pi coding agent, Language Server Protocol, Biome LSP, ty, Ruff, Python LSP, formatter, linter, import organization, AI coding tools.
📄 License
MIT. See LICENSE.
