This VS Code extension integrates Claude Code directly into your VS Code sidebar, allowing you to interact with Claude Code without leaving your editor.
- Sidebar Integration: Adds a Claude Code icon to the VS Code activity bar
- Real Terminal: Opens a real shell terminal (zsh/bash/etc.) in the sidebar with xterm.js
- Auto-start Claude: Automatically runs the
claudecommand when the terminal opens - Auto Cleanup: Automatically closes the Claude session when VS Code exits or restarts
- Full Terminal Support: Full terminal capabilities with proper PTY support using node-pty
Before installing this extension, make sure you have:
- Node.js (v18 or higher) - Download here
- VS Code (v1.85.0 or higher) - Download here
- Claude Code CLI installed and accessible in your PATH
- You can verify this by running
claude --versionin your terminal - If not installed, follow the Claude Code installation guide
- You can verify this by running
- Build Tools (required for node-pty native module):
- macOS: Xcode Command Line Tools -
xcode-select --install - Windows: Visual Studio Build Tools (with C++ workload)
- Linux: build-essential -
sudo apt-get install build-essential(Ubuntu/Debian)
- macOS: Xcode Command Line Tools -
git clone https://github.com/yourusername/sidebar-claude-code-vscode-extension.git
cd sidebar-claude-code-vscode-extensionnpm installImportant: The extension uses node-pty, a native Node.js module that needs to be rebuilt for VS Code's Electron version. The npm install command will automatically rebuild it via the postinstall script. If you encounter any issues, manually rebuild with:
npm run rebuildnpm run compileThis will compile the TypeScript code to JavaScript in the out directory.
There are two ways to install the extension locally:
-
Open the extension folder in VS Code:
code . -
Press
F5or go toRun > Start Debugging -
This will open a new VS Code window with the extension loaded
-
In the new window, you should see the Claude Code icon in the activity bar (sidebar)
-
Install the
vscetool if you haven't already:npm install -g @vscode/vsce
-
Package the extension:
vsce package
This creates a
.vsixfile (e.g.,claude-code-sidebar-0.0.1.vsix) -
Install the packaged extension:
- Open VS Code
- Go to Extensions view (
Ctrl+Shift+XorCmd+Shift+X) - Click the
...menu at the top - Select
Install from VSIX... - Choose the
.vsixfile you just created
-
Reload VS Code when prompted
- Click the Claude Code icon in the activity bar (left sidebar)
- A terminal will open in the sidebar (your default shell: zsh, bash, etc.)
- The extension automatically runs
claudecommand for you - You can now interact with Claude Code directly in the terminal
- Type directly in the terminal - it's a real terminal with full functionality
- Use all Claude Code commands and features as you normally would
- The terminal supports all standard terminal operations (copy, paste, keyboard shortcuts, etc.)
The terminal and Claude session will automatically close when:
- You close VS Code
- You reload VS Code window (
Ctrl+RorCmd+R) - The extension is deactivated
You can also manually exit Claude by typing exit or pressing Ctrl+D, then close the sidebar panel.
- Make sure the extension is installed correctly
- Try reloading VS Code (
Ctrl+RorCmd+R) - Check the Output panel (
View > Output) and select "Claude Code Sidebar" for error messages
- Ensure the
claudecommand is in your system PATH - Try running
claude --versionin your regular terminal - If it doesn't work, reinstall Claude Code CLI or add it to your PATH
This happens when node-pty is compiled for a different Node.js version than VS Code's Electron uses.
Solution:
# Rebuild node-pty for VS Code's Electron version
npm run rebuild
# Or do a fresh install
rm -rf node_modules
npm installThe postinstall script should automatically rebuild node-pty, but if it fails:
- Make sure you have build tools installed (Xcode Command Line Tools on macOS, Visual Studio Build Tools on Windows, build-essential on Linux)
- On macOS:
xcode-select --install - On Ubuntu/Debian:
sudo apt-get install build-essential - On Windows: Install Visual Studio Build Tools
- Check if Claude Code CLI is working correctly outside VS Code
- Look at the VS Code Developer Console (
Help > Toggle Developer Tools) for error messages - Make sure you have the latest version of Claude Code installed
- The extension tries to clean up automatically, but if you notice lingering processes:
- Check running processes:
ps aux | grep claude - Manually kill if needed:
kill <process-id>
- Check running processes:
sidebar-claude-code-vscode-extension/
├── src/
│ └── extension.ts # Main extension code
├── resources/
│ └── claude-icon.svg # Extension icon
├── out/ # Compiled JavaScript (generated)
├── package.json # Extension manifest
├── tsconfig.json # TypeScript configuration
└── README.md # This file
- Edit the TypeScript files in
src/ - Compile:
npm run compile - Test using
F5(Extension Development Host) - Package and install for production use
For active development, you can use watch mode to automatically recompile on changes:
npm run watchCurrently, the extension uses default settings. Future versions may include:
- Custom Claude CLI path
- Terminal appearance settings
- Auto-start preferences
The extension:
- Creates a webview in the VS Code sidebar
- Uses xterm.js to render a real terminal in the webview
- Uses node-pty to create a PTY (pseudo-terminal) running your default shell
- Automatically sends the
claudecommand to the terminal after it starts - Provides full terminal functionality with proper input/output handling
- Cleans up the PTY process when VS Code exits or the extension deactivates
- Customizable terminal appearance (colors, fonts)
- Support for multiple Claude sessions
- Configuration options for shell and Claude CLI path
- Persistent session across VS Code reloads (optional)
- Better error handling and recovery
MIT
Contributions are welcome! Please feel free to submit issues or pull requests.
If you encounter any issues or have questions:
- Check the Troubleshooting section above
- Open an issue on GitHub
- Check the Claude Code documentation
- Sidebar integration with Claude Code icon
- Real terminal using xterm.js and node-pty
- Auto-start Claude command on terminal launch
- Full PTY support with proper terminal emulation
- Auto cleanup on VS Code exit/restart
- Terminal resize support