Getting StartedClaude CodeFAQUse in IDE

How to Use Claude Code in VS Code (or Other IDEs)?

There are two approaches to using Claude Code in VS Code (or other IDEs):

  1. Terminal approach — Works with any IDE, no UI dependency
  2. Extension approach — Exclusive to VS Code and its derivatives (Cursor, Trae, Codium, etc.)

Approach 1: Command-Line Terminal (Universal)

This is the most flexible method, compatible with all IDEs including VS Code, IntelliJ, Eclipse, Vim, and more.

Install the Claude Code CLI

Follow the installation guide for your operating system:

Open a Terminal in Your IDE

  • VS Code: Ctrl+` or menu View → Terminal
  • IntelliJ/WebStorm: Alt+F12 or the Terminal tab at the bottom
  • Other IDEs: Find the built-in terminal feature

Launch Claude Code

In the terminal, type:

claude

Start a Conversation

Type your request directly. Claude Code will:

  • Automatically analyze project files
  • Show diffs and file changes in real time
  • Support ESC ESC to create a checkpoint so you can roll back accidental changes

Type /ide in the terminal to attach the current session to the VS Code / Cursor / JetBrains extension, enabling:

  • Real-time reading of the file currently open in the IDE and the cursor selection
  • Code changes highlighted directly in the IDE’s Diff view, instead of plain text in the terminal
  • Shared IDE linter errors so Claude can fix them in one step
ScenarioAction
First connectionType /ide in the terminal claude session
Check status/ide status
ReconnectIf you switch to a different IDE window, just type /ide again
ShortcutAfter connecting, press Cmd+Esc / Ctrl+Esc in the IDE to quickly open the Claude side panel

One-liner to remember: /ide = instantly give the “black terminal” a “graphical upgrade” — visual diffs, selection-as-context, and instant error fixes.

Pros:

  • No UI dependency — works with monorepos, CI, and remote servers
  • Universal across all IDEs — learn once, use everywhere

Cons:

  • Pure command-line interface; requires typing commands

Approach 2: VS Code Extension (GUI)

Compatible with VS Code and its derivatives (Cursor, Trae, Windsurf, Codium, etc.).

Install the Claude Code Extension

  1. Open the VS Code Extensions panel (Ctrl+Shift+X)
  2. Search for “Claude Code”
  3. Select the official extension published by Anthropic
  4. Click Install

Configure the API (Required for CC Club Users)

⚠️

If you are using CC Club’s service, this configuration step is mandatory!

You need to set primaryApiKey in the config file:

Config file location: ~/.claude/config.json

{
  "primaryApiKey": "crs"
}

Verify the config:

cat ~/.claude/config.json

If this file does not exist, create it manually.

Use the Claude Code Extension

There are multiple ways to interact:

MethodAction
Command PaletteCtrl+Shift+P → type “Claude Code: Start Chat”
SidebarClick the Claude icon in the sidebar and start chatting
Drag and drop filesDrag files into the chat window to use them as context

Pros:

  • Graphical interface with intuitive controls
  • Sidebar chat — no need to switch windows
  • Supports dragging files as context

Cons:

  • Only available for VS Code-based IDEs

Quick Decision Guide

You are…Recommended approach
Terminal user / remote dev / CI integrationCLI approach (Approach 1)
GUI user / prefer sidebar chatVS Code extension (Approach 2)
Want bothInstall the extension, use the CLI as backup

Both approaches share the same login session and config files, so you can switch between them seamlessly at any time.


MIT 2026 © Nextra.
加入社群CC Club返回官网