Claude Code in VS Code: Setup, Shortcuts and CLI Differences
Claude Code in VS Code runs as an extension on VS Code 1.94.0 or later. How to install it, pass selections and files, review diffs, and when to use the CLI.
- The Claude Code extension adds a graphical panel to VS Code, and the docs call it the recommended way to use Claude Code there. It needs VS Code 1.94.0 or later and a paid Claude subscription or a Claude Console account, with no API key.
- The extension bundles its own copy of the CLI for the chat panel but does not put claude on your PATH, so install the standalone CLI to run claude in the integrated terminal.
- The extension and the CLI share ~/.claude/settings.json and the same conversation history, so claude --resume in a terminal can continue an extension conversation.
Claude Code runs as a CLI in the terminal, and also as a VS Code extension that puts it in a graphical panel inside the editor. The docs call the extension the recommended way to use Claude Code in VS Code. This guide covers what you need, how to install it, how to give Claude context and review its edits, the main shortcuts, when to switch to the CLI, MCP and plugins, and what to check when something doesn’t work.
On 2026-10-28 our test environment (macOS) reported Claude Code 2.1.312 from claude --version. VS Code is not installed there, so we did not install the extension or try any of the panel features below (not run). Everything about the extension’s behavior comes from the docs, checked the same day.
Requirements and installation
You need:
- VS Code 1.94.0 or later
- An Anthropic account: any paid Claude subscription (Pro, Max, Team or Enterprise) or a Claude Console account. No API key is required. You sign in with this account the first time you open the extension
To install, press Cmd+Shift+X (Mac) or Ctrl+Shift+X (Windows/Linux) to open the Extensions view, search for “Claude Code” and click Install. The extension ID is anthropic.claude-code. It also installs in Cursor, and in other VS Code forks from the Open VSX registry. If it doesn’t appear after installing, restart VS Code or run Developer: Reload Window from the Command Palette.
The extension’s version number is the Claude Code version it bundles. A feature that needs Claude Code v2.1.286 or later needs version 2.1.286 or later of the extension, which the Extensions view shows. Many features below carry a minimum version like this, so check yours first when something described here is missing.
The extension ships its own copy of the CLI for the chat panel. To run claude in VS Code’s integrated terminal, install the standalone CLI as well. On macOS, Linux and WSL the native installer is:
curl -fsSL https://claude.ai/install.sh | bash
claude --version
Source: https://code.claude.com/docs/en/vs-code, checked 2026-10-28 Source: https://code.claude.com/docs/en/setup, checked 2026-10-28
For the rest of the CLI setup, see getting started with Claude Code.
Opening the panel and signing in
The Spark icon marks Claude Code throughout VS Code. The quickest way in is the Spark icon in the Editor Toolbar, at the top right of the editor. It only appears when a file is open. Other ways in:
- Activity Bar: the Spark icon in the left sidebar opens the sessions list, where you open a session or start a new one. This icon is always visible
- Command Palette:
Cmd+Shift+P/Ctrl+Shift+P, type “Claude Code” and pick an option such as Open in New Tab - Status Bar: ✻ Claude Code at the bottom right works even with no file open
The first time you open the panel, a sign-in screen appears. Click Sign in and finish authorization in the browser.
Past conversations are under the Session history button at the top of the panel, where you can search by keyword or browse by time. Clicking one resumes it. By default, a session with no activity for 14 days moves to Archived sessions, unless it is open, unread or in a group (v2.1.265 or later; the archiveInactiveSessions setting changes the period or turns it off).
If you prefer the CLI-style interface inside VS Code, turn on the Use Terminal setting under Extensions > Claude Code.
Source: https://code.claude.com/docs/en/vs-code, checked 2026-10-28
Giving Claude context
- Selection and open file: Claude sees the text you select in the editor, and which file is open even with nothing selected. Press
Option+K(Mac) /Alt+K(Windows/Linux) to insert an @-mention such as@app.ts#5-10 - Files and folders: type
@and a name. Matching is fuzzy, and folders take a trailing slash, as in@src/components/ - Terminal output:
@terminal:name, wherenameis the terminal’s title - Images and files: paste an image from the clipboard, or hold
Shiftwhile dragging files into the prompt box
To keep this context out of your messages, turn off Attach Selection (v2.1.300 or later) or Attach Open File (v2.1.271 or later) in VS Code’s settings. Both settings also apply when you run claude in the integrated terminal.
The chat panel also withholds selected text from some files. For a workspace file that matches files.exclude or search.exclude, Claude receives at most its path. The same goes for files git ignores, as long as VS Code’s search.useIgnoreFiles and the extension’s respectGitIgnore are both on, which is the default. This filter covers the chat panel only. When claude runs in the integrated terminal, Claude can receive text you select in those files; the docs say to add a Read deny rule to keep a file such as .env away from Claude there.
Source: https://code.claude.com/docs/en/vs-code, checked 2026-10-28
Reviewing edits and switching modes
The current permission mode is shown at the bottom of the prompt box. Click it to switch between Auto, Manual, Plan and Edit automatically. With Claude Code v2.1.283 or later, Auto is the built-in starting mode; on earlier versions that applied only on Pro, Max and Team plans.
- Auto and Edit automatically: Claude edits most files in the workspace without asking
- Manual: before editing a file, Claude shows a side-by-side diff of the original and the proposal and asks for permission. You can accept, reject, or tell Claude what to do instead. If you edit the proposal in the diff before accepting, Claude is told you changed it
- Plan: Claude describes what it will do and waits for approval. VS Code opens the plan as a Markdown document where you can add inline comments first. Typing
/planalso switches to plan mode (v2.1.280 or later)
To review an edit one change at a time, use Accept this change and Reject this change under each change in the diff (v2.1.275 or later). The same actions exist as Claude Code: Accept Change at Cursor and Claude Code: Reject Change at Cursor. A diff with more than 100 changes opens without the per-change buttons, so review it as a whole file.
Checkpoints work in the extension too. Hover over a message for the rewind button, then choose Fork conversation from here, Rewind code to here or Fork conversation and rewind code.
Source: https://code.claude.com/docs/en/vs-code, checked 2026-10-28
For how plan mode works in general, see Claude Code plan mode.
Keyboard shortcuts
| Action | Mac | Windows/Linux |
|---|---|---|
| Toggle focus between the editor and Claude | Cmd+Esc | Ctrl+Esc |
| Open a new conversation in an editor tab | Cmd+Shift+Esc | Ctrl+Shift+Esc |
| Insert an @-mention for the current file and selection (editor focused) | Option+K | Alt+K |
| Reopen the most recently closed Claude session tab | Cmd+Shift+T | Ctrl+Shift+T |
| Toggle Focus view (hide tool activity) | Ctrl+Option+F | Ctrl+Alt+F |
| New line without sending | Shift+Enter | Shift+Enter |
Cmd+N / Ctrl+N starts a new conversation only when Claude is focused and enableNewConversationShortcut is set to true; it is off by default. Every extension command is listed in the Command Palette under “Claude Code”.
Source: https://code.claude.com/docs/en/vs-code, checked 2026-10-28
Extension vs CLI
| Feature | CLI | VS Code extension |
|---|---|---|
| Commands and skills | All | Subset (type / to see them) |
| MCP server config | Yes | Yes, with /mcp in the chat panel |
| Checkpoints | Yes | Yes |
! Bash shortcut | Yes | No |
| Tab completion | Yes | No |
When you need a CLI-only feature, open the integrated terminal (Cmd+` / Ctrl+`) and run claude. The CLI connects to VS Code on its own for diff viewing and diagnostic sharing. From an external terminal, run /ide inside Claude Code to connect it to VS Code.
That connection goes through a local MCP server the extension runs, named ide and hidden from /mcp. Only two of its tools are visible to the model: mcp__ide__getDiagnostics, which reads the errors and warnings in the Problems panel, and mcp__ide__executeCode, which runs Python in the active Jupyter notebook only after you pick Execute in a VS Code prompt. In the chat panel (v2.1.285 or later), diagnostics come from a separate server, so a hook or permission rule that should cover both names mcp__ide__getDiagnostics and mcp__claude-vscode__getDiagnostics.
The extension and the CLI share the same conversation history. To continue an extension conversation in the CLI, run claude --resume in the terminal and pick it from the list.
Settings live in two places. ~/.claude/settings.json is shared by the extension and the CLI and holds allowed commands, environment variables, hooks and MCP servers. Extension-only settings are in VS Code under Extensions > Claude Code.
Source: https://code.claude.com/docs/en/vs-code, checked 2026-10-28 Source: https://code.claude.com/docs/en/commands, checked 2026-10-28
Resuming in the terminal is covered in Claude Code resume, commands in the slash commands cheat sheet, and settings.json rules in Claude Code permissions and settings.json.
MCP and plugins
Type /mcp in the chat panel to add servers, remove servers saved at the local, user or project scope, enable or disable them, reconnect, and manage OAuth. Adding and removing in the dialog needs v2.1.261 or later. claude mcp add in the integrated terminal saves to the same configuration, and changes from either take effect in conversations you start afterwards.
Type /plugins to open Manage plugins. When you install a plugin, you pick a scope:
- Install for you: all your projects (user scope)
- Install for this project: shared with project collaborators (project scope)
- Install locally: only you, only this repository (local scope)
Source: https://code.claude.com/docs/en/vs-code, checked 2026-10-28
When it doesn’t work
- The extension won’t install: check that VS Code is 1.94.0 or later and has permission to install extensions
- No Spark icon: open a file (a folder alone isn’t enough), run Developer: Reload Window, temporarily disable other AI extensions, and check workspace trust, since the extension doesn’t work in Restricted Mode. The ✻ Claude Code status bar item works without a file
Cmd+Escdoes nothing on macOS: on macOS Tahoe and later, the system Game Overlay shortcut takesCmd+Escfirst. Clear the Game Overlay checkbox under System Settings > Keyboard > Keyboard Shortcuts > Game Controllers, or rebindClaude Code: Focus inputin VS Code’s Keyboard Shortcuts editorclaudeisn’t found in the integrated terminal: the extension doesn’t add it to your PATH. Install the standalone CLI- Sign-in prompt despite
ANTHROPIC_API_KEY: VS Code may not have inherited your shell environment. Launch it from a terminal withcode ., or sign in with your Claude account - The panel is blank: update the extension to v2.1.309 or later, then run Developer: Reload Window
Source: https://code.claude.com/docs/en/vs-code, checked 2026-10-28
Related articles
-
Claude Code Setup and Daily Operations: where config files, instructions, daily commands and IDE setup live.
Summary
- The extension needs VS Code 1.94.0 or later and a paid Claude subscription or a Console account, with no API key.
- Its ID is
anthropic.claude-code, and its version number matches the bundled Claude Code, which is what minimum-version notes refer to. - Selections and the open file reach Claude automatically;
Option+K/Alt+Kinserts an @-mention. The chat panel withholds selected text from excluded and gitignored files by default, but the terminal CLI does not. - In Manual mode, every edit is a diff you approve; per-change review needs v2.1.275 or later.
- For CLI-only features, run
claudein the integrated terminal. settings.json and conversation history are shared. - The extension doesn’t put
claudeon your PATH, so install the CLI separately.
FAQ
- What do I need to use Claude Code in VS Code?
- VS Code 1.94.0 or later and an Anthropic account: a paid Claude subscription (Pro, Max, Team or Enterprise) or a Claude Console account. No API key is required.
- Why is claude not found in the VS Code terminal after installing the extension?
- The extension bundles a private copy of the CLI for its chat panel and does not add claude to your PATH. Install the standalone CLI to run claude in the integrated terminal.
- Can I continue a VS Code extension conversation in the CLI?
- Yes. The extension and the CLI share the same conversation history. Run claude --resume in a terminal and pick the conversation from the picker.
- Why does Cmd+Esc do nothing in VS Code on macOS?
- On macOS Tahoe and later, the system Game Overlay shortcut takes Cmd+Esc first. Clear it under System Settings, Keyboard, Keyboard Shortcuts, Game Controllers, or rebind Claude Code: Focus input in VS Code.
- Does the extension send selected text from gitignored files?
- In the chat panel, no: for files that match files.exclude, search.exclude or a gitignore pattern, Claude receives at most the path, as long as the default settings are on. The filter does not apply to claude in the integrated terminal.