vscode-pi-companion
v0.2.0
Published
Share VS Code context with pi coding agent
Readme
VS Code PI Companion
A VS Code extension that provides real-time IDE context (files, selection) to pi and other agents.
Features
- Real-time context: Monitors open files, cursor position, and selection
- Instant updates: Pushes context changes via SSE
- Seamless integration: Selected lines injected into LLM context automatically
- Widget display: Shows current file/selection in pi UI
Architecture
VS Code Extension → SSE ← pi Extension
- VS Code: Context tracking, SSE server
- pi: SSE client, Widget, Context injection
Installation
1. Install pi Extension
pi install git:github.com/ravshansbox/vscode-pi-companionOr manually:
mkdir -p ~/.pi/agent/extensions/vscode-pi-companion
git clone [email protected]:ravshansbox/vscode-pi-companion.git ~/.pi/agent/extensions/vscode-pi-companion
cd ~/.pi/agent/extensions/vscode-pi-companion
npm install2. Install VS Code Extension
The pi extension will auto-install the VS Code extension when you run pi in a VS Code terminal.
Alternatively, install manually:
# Download the .vsix from releases
code --install-extension vscode-pi-companion.vsixThen reload VS Code window.
Usage
- Open a folder in VS Code
- Open VS Code terminal (`Ctrl+``)
- Run
pi - The extension auto-connects and shows current file in widget
- Select code → widget updates instantly
- Selected lines are injected into LLM context automatically
Widget Display
📄 filename # no selection
📄 filename L9 # single line
📄 filename L9:14 # multi-line selectionMCP Tools (for LLM)
| Tool | Description |
|------|-------------|
| get_ide_context | Full IDE context |
| get_current_file | Current file with selection |
| list_open_files | List all open files |
Development
# Build VS Code extension
npm install
npm run compile
# Package as .vsix
npx vsce packagePress F5 to run in Extension Development Host.
