VSCode

How to Use Claude Code in VS Code

How to Use Claude Code in VS Code

Claude Code has an official VS Code extension from Anthropic. It puts a chat panel next to your code, and from that panel you review diffs inline, approve plans before any file changes, and @-mention files or exact line ranges.

Getting it running is quick. Install the extension, sign in, click the Spark icon, and type something. You need VS Code 1.94.0 or later, plus a paid Claude plan or a Claude Console account to sign in with.

The panel runs on a copy of the CLI that ships inside the extension, so it works without a separate install.

The catch that confuses people later: the extension does not put claude on your PATH. If you want claude in a terminal session, you still need the standalone CLI install, per Anthropic’s documentation (November 2026).

How do you install Claude Code in VS Code and sign in?

YouTube player

Grab the extension published by Anthropic from the Extensions view. The first time the panel opens, it sends you to the browser to sign in. A paid Claude plan or a Claude Console account handles authentication, and you don’t need an API key.

What do you need before installing?

VS Code 1.94.0 or later, and an account. That account can be a paid Claude plan (Pro, Max, Team or Enterprise) or a Claude Console account.

Nothing else for the chat panel. The extension brings its own CLI.

You’ll probably see a higher version number in older guides. DataCamp’s tutorial (updated July 2026) and Shopify’s setup guide (August 2026) both say VS Code 1.98.0, and Anthropic’s early beta documentation said the same thing.

As of November 2026, the current Anthropic documentation and the Visual Studio Marketplace listing both say 1.94.0. If something isn’t working, open Help, then About, and check your version before you go digging anywhere else.

Install steps

  1. Press Cmd+Shift+X (Mac) or Ctrl+Shift+X (Windows/Linux) to open the Extensions view.
  2. Search for “Claude Code” and confirm the publisher is Anthropic (extension ID anthropic.claude-code).
  3. Click Install. If the extension does not appear afterward, run “Developer: Reload Window” from the Command Palette.
  4. Open any file, then click the Spark icon in the top-right of the editor toolbar.
  5. Click Sign in and finish authorization in the browser tab that opens.
  6. Type a first prompt, such as a question about the file you have open.

It’s a standard VS Code extension, so the same listing installs in Cursor too. Forks like Devin Desktop and Kiro pick it up from their own Extensions view or from the Open VSX registry.

Sign in and confirm it works

Clicking Sign in opens a browser tab where you authorize the extension. Back in VS Code, a Learn Claude Code checklist shows up in the panel. Close it with the X. If you want it back later, uncheck Hide Onboarding in the extension settings.

Sometimes the sign-in screen keeps coming back even though ANTHROPIC_API_KEY is set in your shell. That usually means VS Code didn’t inherit your shell environment. Start VS Code with code . from a terminal, or just sign in with your Claude account.

If you get “Not logged in” with “Please run /login”, the sign-in screen normally reopens by itself. When it doesn’t, reload the window.

How do you open the Claude Code panel and switch between it and the editor?

YouTube player

Click the Spark icon in the editor toolbar, or run “Open in New Tab” from the Command Palette. To jump keyboard focus between your code and the prompt box, press Cmd+Esc (Mac) or Ctrl+Esc (Windows/Linux).

The toolbar icon isn’t the only way in, and it disappears when no file is open, which is annoying the first time it happens. Other entry points:

  • The Spark icon in the Activity Bar, which is always there and opens the sessions list
  • The Claude Code item at the bottom right of the Status Bar (works with no file open)
  • The Command Palette, where typing “Claude Code” lists every command the extension has

You can drag the panel to the secondary sidebar, the primary sidebar or the editor area. I keep my main session in the secondary sidebar so the code stays visible, and I open side tasks as editor tabs.

Wherever you drop it, the extension remembers. The preferredLocation setting accepts sidebar or panel.

Keyboard shortcuts worth memorizing

ActionMacWindows/Linux
Toggle focus between editor and ClaudeCmd+EscCtrl+Esc
Open a new conversation as a tabCmd+Shift+EscCtrl+Shift+Esc
Insert an @-mention of the file and selectionOption+KAlt+K
Toggle Focus viewCtrl+Option+FCtrl+Alt+F

Cmd/Ctrl+N for a new conversation is off by default. Turn on enableNewConversationShortcut to get it, and note it only fires while Claude has focus.

These bindings live alongside the editor’s own, so a VS Code workflow cheat sheet fills in the rest. There’s also a guided tour of the panel if you run “Claude Code: Open Walkthrough” from the Command Palette.

How do you give Claude Code context from files, selections and the terminal?

Some context arrives without you doing anything. Claude sees whatever text you’ve highlighted and which file is open. On top of that, @-mentions pull in specific files, folders or terminal output. Option+K (Mac) or Alt+K (Windows/Linux) turns the current selection into a reference like @app.ts#5-10.

What Claude sees without being told

Highlighted lines get sent along, and the prompt box footer shows how many. Even with nothing selected, the open file’s name appears in the prompt box.

You can switch both off. attachSelection needs Claude Code v2.1.300 or later and attachOpenFile needs v2.1.271 or later (the extension’s version number is the Claude Code version it bundles).

Turning off attachSelection doesn’t block Option+K or Alt+K. Those still add a selection as an @-mention.

How @-mentions work

Type @ and part of a name. Matching is fuzzy, so “auth” finds auth.js or AuthService.ts. Put a trailing slash on it for a folder, as in @src/components/.

There are size limits. A mentioned file gets inlined only if it fits the Read tool’s default limit of 25,000 tokens, and a text file above 256KB isn’t included at all, per Anthropic’s common workflows documentation (November 2026).

Mentioning a folder gives Claude a file listing, not the contents. That’s useful for showing the shape of one part of the codebase, but you still have to name the files you actually care about.

A few other behaviors worth knowing. Mentioning a file also loads any CLAUDE.md files in that file’s directory and its parents. You can mention several files in one message. And a Read deny rule keeps a path out even if you mention it directly.

Terminal output, images and attachments

For terminal output, write @terminal:name, where name is the terminal’s title. Claude reads the command output, errors or logs, and you skip the copy and paste.

Images can be pasted straight from the clipboard into the prompt box. To attach files by dragging, hold Shift while you drag. Clicking the X on an attachment removes it from context.

With PDFs you can ask for one page, a range like pages 1-10, or an open-ended range. Reading specific pages needs poppler-utils installed on the machine where Claude Code runs.

What the panel holds back

If you select text in a workspace file that matches your files.exclude or search.exclude settings, the chat panel doesn’t pass that text to Claude. The file path can still get through. Files that git ignores are treated the same way as long as search.useIgnoreFiles and the extension’s respectGitIgnore setting are both on, which is the default.

Which permission mode should you use for which task?

Pick based on how bad a wrong edit would be. Plan works for poking around unfamiliar code. Manual is for repositories where you want to see every action. Edit automatically fits contained changes you’ll review once they’re done, and Auto is for long tasks where approving every step gets old fast.

ModeRuns without askingBest fitSetting value
ManualReads onlySensitive repos, checking every actiondefault or manual
PlanReads, plus classifier-approved commands when auto mode is available; edits stay blocked until you approve a planExploring before changing anythingplan
Edit automaticallyReads, file edits, common filesystem commands in the working directoryIterating on code you review afterwardacceptEdits
AutoEverything, with a classifier reviewing in the backgroundLong tasks, fewer promptsBuilt-in default, not an initialPermissionMode value

How the starting mode gets chosen

From Claude Code v2.1.283, a new session in VS Code starts in Auto. Before that version, Auto was the built-in starting mode only on Pro, Max and Team plans, according to Anthropic’s permission modes documentation (November 2026).

You can override it with the initialPermissionMode setting, using default, plan, acceptEdits or bypassPermissions. VS Code only reads this from your VS Code user settings and ignores workspace values (before v2.1.225 it applied them).

There’s a conflict between sources here. DataCamp’s tutorial says you have to turn on the “Allow dangerously skip permissions” setting before auto mode shows up in the selector.

Anthropic’s documentation disagrees. According to it, that setting only adds Bypass permissions to the selector, and from v2.1.283 Auto is the built-in starting mode without it. Check your extension version in the Extensions view before you believe either one.

Where Auto stops

Auto isn’t unlimited. After 3 blocked actions in a row or 20 in total in a session, it pauses and goes back to prompting you. You can’t change either threshold, per Anthropic’s permission modes documentation.

By default it blocks things like piping a download into a shell, force pushes and production deploys. Local file work, installs from lockfiles and read-only HTTP requests go through.

Edit automatically has a limit of its own. Writes to protected paths (such as .git, .vscode, .idea, .husky, .devcontainer and .claude) still ask first, so a session in that mode stops before it touches your editor config. Honestly, that’s the behavior I’d want anyway.

How does plan mode work in the panel?

Choose Plan in the mode indicator, or type /plan (that needs v2.1.280 or later). Adding a task after the command, like /plan fix the auth bug, switches modes and starts planning that task right away.

VS Code opens the plan as a Markdown document. You can leave inline comments on it before Claude starts work. While you’re still in plan mode, /plan open brings the plan file back up.

This mode is worth the extra step for a multi-file code refactoring. The order of edits matters there, and undoing a bad first step is a pain.

From v2.1.246, if a conversation ended in plan mode, it resumes in plan mode. The exceptions: initialPermissionMode or a mode picked in an earlier conversation sets the starting mode, claudeProcessWrapper is set, or a deny rule removes the ExitPlanMode tool.

How do you review and reject Claude’s edits in the diff view?

In Manual mode, Claude shows the original file and the proposed version side by side and waits for you. Accept it, reject it, or type what you want instead.

Reviewing one change at a time

Under each change in the diff you’ll find Accept this change and Reject this change buttons. Accepting or rejecting the whole file still works and ends the review.

You can also edit the proposed text directly in the diff. Claude gets told you modified it, so it won’t assume the file matches what it proposed. If you’d rather stay on the keyboard, “Claude Code: Accept Change at Cursor” and “Reject Change at Cursor” are in the Command Palette and the editor context menu.

Per-change review needs Claude Code v2.1.275 or later. DataCamp’s tutorial (updated July 2026) still says hunk-level approval is missing, which no longer matches the current Anthropic documentation.

Once a diff passes 100 changes, the per-change buttons go away. Review it as a whole file, or ask Claude to break a big edit into smaller steps.

What changes when Claude does not ask

Only Manual shows you each edit before it hits disk. In Edit automatically and Auto, changes to most workspace files land with no prompt, and you review after the fact.

So commit or stash first. With version control holding a clean baseline, reviewing Claude’s work is just a normal diff against the last commit.

The autosave setting is on by default. It writes your unsaved edits to disk before Claude reads or writes a file, so Claude is working on the same text you see.

How do you resume sessions and rewind changes with checkpoints?

Session history, at the top of the panel, gets you back into an old conversation. Hovering over a message shows a rewind button. One restores the conversation and the other restores the code, and it’s easy to mix them up at first.

Resuming past conversations

The Session history button lists your conversations. Search by keyword or browse by time, then click one to resume it. If it’s already open in this window, you jump to its tab.

Hover actions let you rename or archive a session. Right-clicking lets you put sessions into named groups. You can unarchive a single session or all archived sessions at once.

After 14 days without activity, a session moves to Archived sessions automatically, unless it’s open, unread or in a group. The archiveInactiveSessions setting takes 1, 2, 7 or 14 days. Set it to 0 to turn archiving off.

Cloud sessions from claude.ai resume through the Web tab of the same dialog. You need a claude.ai sign-in for that, not a Console account. The extension downloads a copy, so nothing you change there syncs back.

The extension and the CLI share conversation history. Run claude –resume in a terminal and you can pick up a conversation you started in the panel.

Rewinding with checkpoints

Each prompt that starts a turn creates a checkpoint. Claude Code keeps file snapshots for the 100 most recent checkpoints in a session, according to Anthropic’s checkpointing documentation (November 2026).

  • Fork conversation from here starts a new branch at that message and leaves the code alone
  • Rewind code to here reverts the files but keeps the whole conversation
  • Fork conversation and rewind code does both

Rewind only knows about what Claude’s file tools touched. Here’s where it stops helping:

ChangeRestored by rewind?To revert it
Edits from Claude’s file toolsYesRewind code
Other changes to a file Claude’s tools also edited in the sessionUsuallyRewind code, then check the file
A file only a Bash command changedNoGit
Most subagent editsNoGit
Manual edits outside Claude Code to files the session never editedNoYour own editor history or Git

Snapshots are deleted about 30 days after a session last saved one. Rewinding past that can fail with “No files were restored”. Raise cleanupPeriodDays in settings.json if you want them kept longer.

Symlinked and hard-linked files get skipped on restore, and you’ll see a “Restored the code, but skipped N files” warning. Checkpoints also only cover one session. Your commits are still the real record.

Running several conversations at once

“Open in New Tab” or “Open in New Window” starts another conversation, with its own history and context.

Watch the Spark icon. A blue dot means a permission request is waiting. An orange dot means Claude finished while that tab was hidden.

After “Developer: Reload Window”, a conversation in an editor tab comes back with its tab. A sidebar conversation only comes back if someone (you or Claude) sent a message in it within the last 10 minutes. Older ones you’ll need to resume from Session history.

If the reload interrupted Claude in the middle of a step, that step continues when the conversation returns. The continueAfterReload setting controls this.

Where do settings, MCP servers and plugins live?

Settings are split across two places. Extension settings cover the panel. ~/.claude/settings.json holds what the extension and the CLI share, like allowed commands, environment variables, hooks and MCP servers.

To get to extension settings, press Cmd+, or Ctrl+, and go to Extensions, then Claude Code. Those keys are the claudeCode.* entries in your VS Code settings.json, which is not the same file as the shared one.

Small tip that saves a lot of typos. Put a “$schema” line pointing to https://json.schemastore.org/claude-code-settings.json at the top of ~/.claude/settings.json, and VS Code will autocomplete and validate every key.

How do you add MCP servers?

Type /mcp in the chat panel. From that dialog you can add servers, remove them at local, user or project scope, toggle and reconnect them, and handle OAuth (adding and removing need Claude Code v2.1.261 or later).

If you prefer the terminal, claude mcp add in the integrated terminal writes to the same configuration. The server loads in conversations you start after that.

Anthropic’s MCP documentation recommends HTTP as the transport. SSE is deprecated, and stdio runs a local process.

Scope controls who gets a server.

ScopeLoads inShared with teamStored in
Local (default)Current project onlyNo~/.claude.json, under the project path
ProjectCurrent project onlyYes, through version control.mcp.json in the project root
UserAll your projectsNo~/.claude.json

If the same server is defined in more than one place, the highest one wins and fields aren’t merged. The order is local, then project, then user, then plugin servers, then claude.ai connectors.

Don’t assume a server works just because it saved. claude mcp add doesn’t validate credentials, so a placeholder token gets accepted and the server fails later. Start a new conversation, type /mcp, and make sure it says Connected and not Failed.

Keep an eye on output size too. Claude Code warns when an MCP tool returns more than 10,000 tokens. That usually means the server is pushing far more into the context window than the task needs.

What else sits in the command menu?

  • Instructions opens the CLAUDE.md files Claude reads, and creates one if it’s missing (v2.1.274 or later)
  • Memory turns auto memory on or off, and you can read, edit or delete saved memories there
  • Hooks lists loaded hooks by event and lets you edit the ones saved in user, project and local settings (v2.1.269 or later)
  • Permissions shows your Allow, Ask and Deny rules, scoped the same way
  • Plugins opens the /plugins dialog, which has Plugins and Marketplaces tabs and install scopes for you, for the project or locally

Hooks that come from managed settings or plugins are read-only here, and so are rules from managed settings or session-only approvals. Plugins and marketplaces set up in the extension also show up in the CLI, and it works the other way too.

How does the extension differ from the CLI and from Claude in GitHub Copilot?

All three get called “Claude in VS Code”, which DataCamp’s tutorial points out, and it’s why search results for that phrase mix up setup guides so badly.

The extension gives you a graphical panel and runs Claude Code through its bundled CLI. Running the CLI yourself gets you the same agent in a terminal. Copilot’s Claude models come from GitHub and are a different product entirely.

FeatureExtensionCLI in terminalClaude in Copilot
Made byAnthropicAnthropicGitHub, with Anthropic models
Runs inChat panelIntegrated terminalCopilot Chat
Commands and skillsSubsetAllCopilot’s own
! shortcut, tab completionNoYesNot applicable
AccessClaude plan or Console accountSame, plus standalone CLI installCopilot plan (Free and Student: auto model selection only)

What the CLI still does better

The panel only carries a subset of commands and skills. In the terminal you get the full list, along with the ! Bash shortcut and tab completion, and I miss that last one every time I’m in the panel.

Open the integrated terminal with Ctrl+ (Windows/Linux) or Cmd+ (Mac) and run claude. Since the extension never adds claude to your PATH, this only works with the standalone CLI installed.

There’s a middle option as well. Turn on the useTerminal setting and the panel switches to the CLI-style interface. An external terminal can connect with /ide.

How does the extension talk to the editor?

Diffs, selections and diagnostics move between VS Code and the bundled CLI through a local ide MCP server. It binds to 127.0.0.1 and needs an auth token, which is generated fresh each time the extension activates and stored in a lock file under ~/.claude/ide/.

mcp__ide__getDiagnostics returns the errors and warnings from the Problems panel. From Claude Code v2.1.285, the chat panel gets that same data as mcp__claude-vscode__getDiagnostics. So if you write a deny rule or hook for diagnostics, it has to name both.

For notebooks, mcp__ide__executeCode runs Python in the active Jupyter kernel, but only after you pick Execute in a Quick Pick. It needs the Jupyter extension (ms-toolsai.jupyter) and a Python kernel.

Extension or Copilot’s Claude models?

GitHub’s supported models page lists Claude Haiku 5.5, Opus 5.5 and Sonnet 5.5 among its Claude models. Copilot Free and Student users only reach models through auto model selection.

Copilot also wants a newer editor. GitHub lists VS Code 1.118 for Opus 4.8, 1.124 for Sonnet 5 and 1.128.0 for Opus 5, all higher than the 1.94.0 the extension needs.

The bigger difference is the kind of work each one does. Claude Code works on tasks, not on keystroke autocomplete, and DataCamp suggests running it alongside GitHub Copilot if you want both.

My take: agentic multi-file work with plan review and checkpoints belongs in the extension. For inline completion, GitHub Copilot covers something Claude Code just doesn’t do.

What breaks, and where does the extension stop working?

Usually it’s a requirement you haven’t met, an environment the extension can’t see, or something that only exists in the CLI. Below, the most common problems come first.

Fixing the common failures

No Spark icon? Open a file first, since the toolbar icon needs one. Then confirm VS Code 1.94.0 or later, reload the window, and disable other AI extensions such as Cline or Continue. The Status Bar entry works even without an open file.

The extension doesn’t run in Restricted Mode. Trust the workspace.

“Could not locate the Claude CLI on PATH” is listed in Anthropic’s error reference under wrapper and IDE errors, meaning the launching program prints it, not Claude Code. If the terminal doesn’t have claude, install the standalone CLI. If your platform’s extension build doesn’t bundle a binary, point claudeProcessWrapper at one you installed separately.

A 403 after sign-in, and cloud credentials that only work in the terminal, each have their own entry on Anthropic’s install troubleshooting page.

For a blank panel, update the extension to v2.1.309 or later and run “Developer: Reload Window”. A “Claude Code couldn’t load” notice comes with steps, so follow those. If the panel still fails, read the log with “Claude Code: Show Logs”.

Fixing certificate errors behind a TLS-inspecting proxy

Errors like “unable to get local issuer certificate” come from a TLS-inspecting proxy, a missing NODE_EXTRA_CA_CERTS bundle or an expired certificate. In the extension, you’ll see them in dictation and in the Web tab.

  1. Update the extension to version 2.1.307 or later.
  2. Ask your IT team for the proxy’s root CA certificate as a PEM file.
  3. Set NODE_EXTRA_CA_CERTS in the env block of ~/.claude/settings.json to the file’s full path, without ~ (on Windows, write each backslash twice).
  4. Save, then start a recording or click Reconnect on the Web tab.

Working in a WSL, SSH or dev container window? Save the certificate and edit the settings file on that system, not your local one. Also, a value set in the environment VS Code launched with overrides the file, even if it points to a path that doesn’t work.

Shortcut clashes

On macOS Tahoe and later, the system Game Overlay shortcut grabs Cmd+Esc before VS Code ever sees it. Either clear the Game Overlay checkbox under System Settings, Keyboard, Keyboard Shortcuts, Game Controllers, or rebind “Claude Code: Focus input” in the Keyboard Shortcuts editor (Cmd+K Cmd+S).

Ctrl+J inserts a new line in the prompt box. To remove it, set “ctrl+j” to null in a Chat block of keybindings.json in your Claude Code configuration directory (extension 2.1.309 or later).

Where the extension stops

  • Excluded-file filtering only applies to the chat panel. In terminal mode, or when claude runs in the integrated terminal, Claude can receive text you select in those files. Add a Read deny rule for the path if that matters.
  • Bypass permissions only appears once you turn on allowDangerouslySkipPermissions, and Anthropic says to use it only in sandboxes with no internet access. Deny rules still apply in every mode, bypassPermissions included, but allow rules do nothing there.
  • On Amazon Bedrock, Google Cloud’s Agent Platform or Microsoft Foundry, you lose plan usage bars, voice dictation and the Web tab, because they need a claude.ai account.
  • If you signed in to claude.ai earlier through /login, that sign-in just sits unused on a third-party provider.

Claude Code in VS Code FAQ

Can Claude Code create commits and pull requests from the panel?

Yes. Ask in plain language, something like “commit my changes with a descriptive message” or “create a pr for this feature”. Claude stages the changes and writes the commit message.

Pull request descriptions are based on the actual code changes.

Is Claude Code available on the free Claude plan?

No. For sign-in, Anthropic’s documentation lists the Pro, Max, Team and Enterprise plans or a Claude Console account. DataCamp and Shopify both say Claude Code isn’t on the free plan.

How do I use Claude Code with Amazon Bedrock or Microsoft Foundry?

Turn on the Disable Login Prompt setting under Extensions, then Claude Code. After that, set up the provider in ~/.claude/settings.json using Anthropic’s guide for Amazon Bedrock, Google Cloud’s Agent Platform or Microsoft Foundry.

The CLI reads that same file, so you only configure it once.

How does @browser connect Claude Code to Chrome?

You need the Claude in Chrome extension, version 1.0.36 or later. Then type @browser in the prompt box with the task after it, for example “go to localhost:3000 and check the console for errors”.

Claude opens new tabs and uses your browser’s login state, so any site you’re already signed into is reachable.

Where can I see how much of my usage limit a session has used?

Type /usage and the Account & usage dialog opens. On a claude.ai plan you get bars for your plan limits and how long until each one resets. A Day and Week toggle flips between the last 24 hours and 7 days. Treat the figures as approximate, since they’re built from local sessions on this machine.

How do I check on a background command or subagent?

Type /tasks in the prompt box. That opens the agent map, which lists subagents and background tasks like a dev server. Click one to see its latest output or stop it.

If a command is slow, click Run in background under its tool call and Claude keeps going (v2.1.287 or later).

Why does the extension come back after I uninstall it?

Running claude in VS Code’s integrated terminal reinstalls it. Turn off Auto-install IDE extension in /config, or set autoInstallIdeExtension to false, and it stays gone.

For a full cleanup, also delete the anthropic.claude-code folder in VS Code’s globalStorage directory.

Choosing a First Task for Claude Code in VS Code

YouTube player

Start with a read-only question about your own project. You get to see what Claude sees, and nothing on disk can change while you do. A project overview works, or ask it to trace one function.

Before you ask anything, set the mode indicator to Plan or Manual. A fresh session on Claude Code v2.1.283 or later opens in Auto by default, and in Auto edits land without a diff prompt.

Once the read-only answer looks right, commit, then let Claude make one small edit and approve it in the diff.

This costs you one approval click per edit, and on a long task that gets slow. Switch to Edit automatically or Auto after that first small edit comes back correct, not before.

All of this matches Anthropic’s documentation as of November 2026. If the starting permission mode changes, the order above changes with it, so check the defaults again after big extension updates.

Bogdan Sandu

Stay sharp. Ship better code.

Every week: one curated article, one tool worth knowing, one tip you can use tomorrow. No noise, no padding.