← Catalog

@dreki-gg/pi-lsp

Language-agnostic LSP code intelligence for pi — diagnostics, hover, definitions, references, symbols, and call hierarchy

Package

Install

Install with PiG

pig install npm:@dreki-gg/pi-lsp

Install with Pi

pi install npm:@dreki-gg/pi-lsp
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./extensions/lsp"
  ]
}

README

Written by the package's publisher, shown as published in version 0.5.2 (README.md). PiG does not review it.

@dreki-gg/pi-lsp

Language-agnostic code intelligence for pi via Language Server Protocol. Purely config-driven — you define which servers to use per project.

Install

pi install npm:@dreki-gg/pi-lsp

Tool

Single unified lsp tool with 11 operations:

OperationDescriptionRequired params
diagnosticsType errors + lint warningsfilePath
hoverType info and documentationfilePath, line, character
goToDefinitionFind where a symbol is definedfilePath, line, character
findReferencesFind all references to a symbolfilePath, line, character
goToImplementationFind implementations of interface/abstractfilePath, line, character
documentSymbolList all symbols in a filefilePath
workspaceSymbolSearch symbols across the workspacequery
prepareCallHierarchyGet call hierarchy item at positionfilePath, line, character
incomingCallsFind callers of a functionfilePath, line, character
outgoingCallsFind callees of a functionfilePath, line, character
codeActionsQuick fixes and refactoring suggestionsfilePath, line, character

All line/character params are 1-indexed (matching the read tool output).

Configuration

Servers are configured via two config files (project overrides global):

FileScope
~/.pi/agent/extensions/lsp/config.jsonGlobal defaults
.pi/lsp.jsonProject-local overrides

On first run a starter config.json is scaffolded with example servers (TypeScript, Python, Rust, Go) — all disabled by default. No language server is enabled out of the box; flip "disabled": false (or remove the flag) on the ones you want. This keeps the extension from spawning a server you never asked for.

Example: TypeScript + oxlint

.pi/lsp.json:

{
  "lsp": {
    "typescript": {
      "command": ["typescript-language-server", "--stdio"],
      "extensions": [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"]
    }
  }
}

typescript-language-server automatically uses the project's local node_modules/typescript, so your project's TS version is always respected.

Adding other servers

.pi/lsp.json:

{
  "lsp": {
    "rust": {
      "command": ["rust-analyzer"],
      "extensions": [".rs"]
    },
    "python": {
      "command": ["pyright-langserver", "--stdio"],
      "extensions": [".py"],
      "initialization": {
        "python": { "analysis": { "typeCheckingMode": "basic" } }
      }
    }
  }
}

Disabling a server

{
  "lsp": {
    "typescript": { "disabled": true }
  }
}

Disabling all LSP

{
  "lsp": false
}

Server config options

PropertyTypeDescription
commandstring[]Command + args to spawn (e.g. ["rust-analyzer"])
extensionsstring[]File extensions with leading dot
disabledbooleanDisable this server
envobjectEnvironment variables for the server process
initializationobjectOptions sent during LSP initialize handshake

How it works

  • Auto-detection: Servers are matched to files by extension. Multiple servers can handle the same extension.
  • Routing: diagnostics aggregates from all matching servers. Other operations use the first server with the required capability.
  • Lazy start: Servers spawn on first tool use, stay alive for the session.
  • Config merge: Project .pi/lsp.json overrides global ~/.pi/agent/extensions/lsp/config.json.

Commands

CommandDescription
/lspShow server status, detected servers, and extensions
/lsp-restartStop all servers (reinitialize on next tool use)

Architecture

extensions/lsp/
├── index.ts       — Entry point, server manager, lifecycle
├── protocol.ts    — JSON-RPC over stdio transport
├── client.ts      — High-level LSP client (all 11 operations)
├── config.ts      — Config loading, merging, server resolution
├── tools.ts       — Single unified `lsp` tool registration
├── formatting.ts  — Format all LSP responses for LLM consumption
└── types.ts       — LSP protocol types, config types, operation enums