Nanocoder includes a VS Code extension that provides live diff previews of file changes directly in your editor. When the AI suggests file modifications, you can see exactly what will change before approving.
There are two ways to install the VS Code extension:
When you run Nanocoder with the --vscode flag for the first time, it will automatically prompt you to install the extension:
nanocoder --vscodeIf the extension isn't installed, you'll see a prompt asking if you'd like to install it. Select "Yes" to install it.
If you prefer to install manually or the automatic installation doesn't work:
-
Locate the VSIX file: After installing Nanocoder, the extension is bundled at:
- npm global install:
$(npm root -g)/@nanocollective/nanocoder/assets/nanocoder-vscode.vsix - From source:
./assets/nanocoder-vscode.vsix
- npm global install:
-
Install via VS Code CLI:
code --install-extension /path/to/nanocoder-vscode.vsix
-
Or install via VS Code UI:
- Open VS Code
- Press
Cmd+Shift+P(macOS) orCtrl+Shift+P(Windows/Linux) - Type "Extensions: Install from VSIX..."
- Select the
nanocoder-vscode.vsixfile
-
Reload VS Code after installation
-
Start Nanocoder with VS Code integration:
nanocoder --vscode
Or from within VS Code:
- Press
Cmd+Shift+P/Ctrl+Shift+P - Run "Nanocoder: Start Nanocoder CLI"
- Press
-
The extension connects automatically when Nanocoder starts with
--vscode -
View diff previews: When Nanocoder suggests file changes, a diff view automatically opens in VS Code showing:
- The original file content on the left
- The proposed changes on the right
- Syntax highlighting for the file type
-
Approve or reject changes: Use the Nanocoder CLI to approve or reject the changes. The diff preview is read-only and for visualization only.
-
Status bar: The Nanocoder status bar item shows connection status:
$(plug) Nanocoder- Not connected (click to connect)$(check) Nanocoder- Connected to CLI$(sync~spin) Connecting...- Connection in progress
The extension can be configured in VS Code settings (Cmd+, / Ctrl+,):
| Setting | Default | Description |
|---|---|---|
nanocoder.autoConnect |
true |
Automatically connect to Nanocoder CLI on startup |
nanocoder.serverPort |
51820 |
Port for WebSocket communication with CLI |
nanocoder.showDiffPreview |
true |
Automatically show diff preview for file changes |
Example settings.json:
{
"nanocoder.autoConnect": true,
"nanocoder.serverPort": 51820,
"nanocoder.showDiffPreview": true
}Access these commands via the Command Palette (Cmd+Shift+P / Ctrl+Shift+P):
| Command | Description |
|---|---|
Nanocoder: Connect to Nanocoder |
Manually connect to running Nanocoder CLI |
Nanocoder: Disconnect from Nanocoder |
Disconnect from CLI |
Nanocoder: Start Nanocoder CLI |
Open terminal and start nanocoder --vscode |
Extension not connecting?
- Ensure Nanocoder is running with
--vscodeflag - Check the Nanocoder output channel in VS Code (
View > Output > Nanocoder) - Verify port 51820 is not blocked by a firewall
Diff not showing?
- Check that
nanocoder.showDiffPreviewis enabled in settings - Ensure the extension is connected (check status bar)
Connection drops frequently?
- This can happen if you restart the CLI. Click the status bar to reconnect.