A Visual Studio 2022 extension that integrates Claude Code AI assistant directly into your IDE.
- Dedicated tool window with full chat functionality
- Streaming responses for real-time feedback
- Markdown rendering for formatted responses
- Conversation history within your session
- Right-click context menu for quick actions on selected code
- Automatic context includes current file and selection
- Solution awareness understands your project structure
| Command | Shortcut | Description |
|---|---|---|
| Open Chat | Ctrl+K, Ctrl+C |
Opens the Claude Code chat window |
| Ask About Selection | Ctrl+K, Ctrl+A |
Ask about selected code |
| Explain Code | Right-click menu | Get detailed code explanation |
| Fix Error | Right-click menu | Ask Claude to fix errors |
| Generate Tests | Right-click menu | Generate unit tests |
- Visual Studio 2022 (version 17.0 or later)
- Claude Code CLI installed and authenticated
# Using npm
npm install -g @anthropic-ai/claude-code
# Authenticate
claude auth login- Download the
.vsixfile from Releases - Double-click to install, or use Extensions > Manage Extensions in Visual Studio
- Restart Visual Studio
# Clone the repository
git clone https://github.com/anthropics/claude-code-visual-studio.git
cd claude-code-visual-studio
# Open in Visual Studio
start ClaudeCodeVisualStudio.sln
# Build (or press F5 to debug)
dotnet build- Press
Ctrl+K, Ctrl+Cor go to Tools > Open Claude Code Chat - Type your question and press Enter or click Send
- Select code in the editor
- Right-click and choose Ask Claude About Selection or Explain This Code
- The chat window opens with your code as context
- Right-click in the editor
- Choose Fix Error with Claude
- Claude analyzes current errors and suggests fixes
- Select a class or method
- Right-click and choose Generate Tests
- Claude creates comprehensive unit tests
Go to Tools > Options > Claude Code to configure:
| Setting | Default | Description |
|---|---|---|
| CLI Path | auto-detect | Path to Claude Code CLI |
| Default Model | Sonnet | Claude model to use |
| Auto-Include Context | true | Include file context automatically |
| Max Context Lines | 500 | Maximum lines to include |
| Stream Responses | true | Stream responses as they arrive |
| Theme | Auto | Light/Dark/Auto |
┌─────────────────────────────────────────────────────────────┐
│ Visual Studio 2022 │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ │
│ │ Tool Window │ │ Commands │ │ Editor Context │ │
│ │ (Chat UI) │ │ (Menu/KB) │ │ Provider │ │
│ └──────┬──────┘ └──────┬──────┘ └────────┬────────┘ │
│ └──────────────────┼───────────────────┘ │
│ ┌──────▼──────┐ │
│ │ ClaudeCode │ │
│ │ Service │ │
│ └──────┬──────┘ │
├────────────────────────────┼────────────────────────────────┤
│ ┌──────▼──────┐ │
│ │ Claude CLI │ │
│ └──────┬──────┘ │
└────────────────────────────┼────────────────────────────────┘
┌──────▼──────┐
│ Anthropic │
│ API │
└─────────────┘
ClaudeCodeVisualStudio/
├── src/
│ ├── ClaudeCodePackage.cs # Extension entry point
│ ├── Commands/ # VS commands
│ │ ├── OpenChatCommand.cs
│ │ ├── AskAboutSelectionCommand.cs
│ │ ├── ExplainCodeCommand.cs
│ │ ├── FixErrorCommand.cs
│ │ └── GenerateTestCommand.cs
│ ├── Services/ # Core services
│ │ ├── ClaudeCodeService.cs
│ │ └── EditorContextProvider.cs
│ ├── ToolWindows/ # WPF UI
│ │ ├── ChatToolWindow.cs
│ │ └── ChatToolWindowControl.xaml
│ ├── Models/ # Data models
│ └── Utils/ # Utilities
├── assets/ # Icons and images
├── ARCHITECTURE.md # Detailed architecture docs
└── README.md
- Visual Studio 2022 with Visual Studio extension development workload
- .NET Framework 4.8 SDK
- Claude Code CLI for testing
- Open the solution in Visual Studio
- Press F5 to launch the experimental instance
- The extension loads automatically in the experimental VS
dotnet build -c Release
# Output: bin/Release/ClaudeCodeVisualStudio.vsix- Ensure CLI is installed:
npm install -g @anthropic-ai/claude-code - Verify it's in PATH:
claude --version - Or set the path manually in Tools > Options > Claude Code
Run claude auth login in your terminal to authenticate.
- Check your network connection
- The first request may take longer due to CLI initialization
- Consider using a faster model (Haiku) for quick tasks
- Inline code completions
- Code lens integration
- Multi-file refactoring preview
- Git integration (commit messages, PR descriptions)
- Custom prompt templates
- Team sharing
- MCP server support
- Enterprise proxy configuration
- Advanced caching
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.
