Claude Code VS Code拡張の設定—CLIと別バイナリで動く仕組み

VS Code拡張機能を入れた環境で、ターミナルとエディタのclaudeを突き合わせたら版が違いました。

$ claude --version
2.1.239 (Claude Code)

$ ~/.vscode/extensions/anthropic.claude-code-2.1.235-darwin-arm64/resources/native-binary/claude --version
2.1.235 (Claude Code)

拡張機能は自前のclaudeを抱えていて、PATH上のCLIとは無関係に動きます。

目次

拡張機能はPATH上のclaudeを呼ばない

309MBのうち299MBが同梱バイナリ

$ du -sh ~/.vscode/extensions/anthropic.claude-code-2.1.235-darwin-arm64
309M	/Users/moha/.vscode/extensions/anthropic.claude-code-2.1.235-darwin-arm64

$ ls -lh ~/.vscode/extensions/anthropic.claude-code-2.1.235-darwin-arm64/resources/native-binary/
total 611984
-rwxr-xr-x@ 1 moha  staff   299M Aug 19 16:59 claude

拡張機能はこのclaudeを子プロセスとして起動します。設定項目claudeCode.claudeProcessWrapperの説明が、その前提をそのまま書いています。

The bundled binary path is passed as an argument when present.

プラットフォーム向けのバイナリが同梱されていないビルドを引くと、拡張機能は起動時に “Unsupported platform” を出します。その回避策が、別途インストールしたclaudeclaudeProcessWrapperに指定するやり方です。

ターミナルからは呼べない

公式ドキュメントの “VS Code extension vs. Claude Code CLI” は、拡張機能がPATHを触らないと明記しています。

the extension does not add claude to your PATH

手元のclaude~/.local/bin/claudeにあり、実体は~/.local/share/claude/versions/2.1.239へのシンボリックリンクでした。拡張機能の2.1.235とは更新経路が別なので、片方を上げても片方は据え置きのままです。

版ずれが効いてくる場面

公式ドキュメントは機能ごとに下限バージョンを書いています。Focus viewはv2.1.221以降、セッションのグループ化はv2.1.229以降、チャットパネルのスクリーンリーダー対応はv2.1.236以降。CLIが2.1.239でも、拡張機能が2.1.235のままなら最後の1つは入っていません。

拡張機能側を上げるのはコマンドパレットの “Claude Code: Update extension” で、claude updateでは動きません。ただしこのコマンド自体、claude-vscode.updateSupportedが真のときだけパレットに現れます。

ワークスペース設定に書いても効かない項目

拡張機能の設定はpackage.jsoncontributes.configurationに定義されています。scope属性を並べると、置ける場所が項目ごとに違うと分かります。

$ python3 -c "
import json
d=json.load(open('/Users/moha/.vscode/extensions/anthropic.claude-code-2.1.235-darwin-arm64/package.json'))
for k,v in d['contributes']['configuration']['properties'].items():
    print(k, '|', v.get('scope','window'))
"
claudeCode.environmentVariables | machine
claudeCode.useTerminal | window
claudeCode.allowDangerouslySkipPermissions | machine
claudeCode.claudeProcessWrapper | machine
claudeCode.respectGitIgnore | window
claudeCode.initialPermissionMode | machine
claudeCode.disableLoginPrompt | window
claudeCode.autosave | window
claudeCode.focusView | application
claudeCode.useCtrlEnterToSend | window
claudeCode.preferredLocation | window
claudeCode.enableNewConversationShortcut | window
claudeCode.enableReopenClosedSessionShortcut | window
claudeCode.hideOnboarding | window
claudeCode.usePythonEnvironment | window

machineスコープは.vscode/settings.jsonを読まない

scopeの意味を決めているのはVS Code側です。Contribution Pointsのconfigurationの節が定義しています。

machine: Machine specific settings that can be set only in user settings or only in remote settings.
application: Settings that apply to all instances of VS Code and can only be configured in user settings.

machineとapplicationの項目は、リポジトリにコミットする.vscode/settings.jsonに書いてもVS Codeが読みません。上の出力を突き合わせると、対象は次の5項目です。

設定キーscope.vscode/settings.jsonでの上書き
claudeCode.initialPermissionModemachine不可
claudeCode.environmentVariablesmachine不可
claudeCode.claudeProcessWrappermachine不可
claudeCode.allowDangerouslySkipPermissionsmachine不可
claudeCode.focusViewapplication不可(全ウィンドウ共通)
claudeCode.useTerminal ほか10項目window

公式ドキュメントの “Extension settings” にも同じ話が出てきます。

VS Code reads initialPermissionMode from your user settings and ignores workspace values. Before v2.1.225, VS Code defaulted the setting to default and applied workspace values.

v2.1.225より前は逆で、ワークスペース値が効いていました。当時の記述を残したまま拡張機能を上げたリポジトリでは、権限モードの初期値が黙って変わっています。.vscode/settings.jsongit logで追っても、変わったのはVS Code側の解釈なので差分は出ません。

チームで配るなら置き場を変える

やりがちなのがこれ。

// .vscode/settings.json -- これは効かない
{
  "claudeCode.initialPermissionMode": "plan"
}

権限まわりをリポジトリで揃えたいなら、VS Code側ではなくClaude Code側の設定ファイルに寄せます。公式ドキュメントの “Configure settings” は、~/.claude/settings.jsonを拡張機能とCLIの共有設定として位置づけています。

Claude Code settings in ~/.claude/settings.json: shared between the extension and CLI. Use it for allowed commands, environment variables, hooks, and MCP servers.

プロジェクト単位で配るなら.claude/settings.json。ここに置いた許可コマンド・フック・環境変数は、拡張機能からもCLIからも同じように読まれます。プロジェクト側の設定ファイルがどう読まれるかはClaude CodeはAGENTS.mdを読まないでも扱いました。

補完とバリデーションを効かせるなら$schemaを足します。拡張機能のディレクトリにも同じスキーマがclaude-code-settings.schema.jsonとして同梱されています。

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json"
}

Cmd+Escの役割はuseTerminalで入れ替わる

キーバインドはpackage.jsonwhen句で切り替わります。claudeCode.useTerminalfalseのとき、Cmd+Escはエディタとプロンプト欄のフォーカス移動。trueにすると、同じキーが統合ターミナルでのClaude起動に変わります。

@メンション挿入のコマンドも二重化しています。パネル利用時はAlt+Kclaude-vscode.insertAtMention、ターミナルモード時だけCmd+Alt+Kclaude-code.insertAtMentionedが有効。公式ドキュメントのショートカット表に載っているのは前者だけなので、ターミナルモードでAlt+Kが反応しないときはここを疑います。

コマンドパレットに出ないCreate Worktree

claude-vscode.createWorktree、表示名 “Claude Code: Create Worktree” はpackage.jsonに登録済みです。ただしパレットへの表示条件が付いています。

{"command": "claude-vscode.createWorktree", "when": "claude-vscode.createWorktreeEnabled"}

公式ドキュメントの “VS Code commands and shortcuts” のコマンド表には出てきません。表示条件が付いている以上、パレットに出ないのは未実装ではなく無効化です。worktree自体の設計はClaude Code worktreeの使い方にまとめてあります。

CLIにしか無い機能をどう埋めるか

公式が挙げている差

公式ドキュメントの “VS Code extension vs. Claude Code CLI” が差分を表にしています。

機能CLIVS Code拡張
コマンドとスキル全部一部(/で確認)
MCPサーバー設定追加はCLI、既存の管理は/mcp
チェックポイント
! のbashショートカット不可
Tab補完不可

統合ターミナルへ逃がす

CLI専用の機能が要るときは、VS Codeの統合ターミナルでclaudeを起動します。拡張機能はPATHにclaudeを置かないので、統合ターミナルで叩けるのはCLIを別途入れた場合だけ。入れていなければcommand not foundで終わります。

逆に、チェックポイントは拡張機能でも使えます。メッセージにホバーすると巻き戻しボタンが出て、会話だけ分岐・コードだけ巻き戻し・両方、の3通りから選べる形です。

旧バージョンが1.1GB残っていた

$ ls -1 ~/.vscode/extensions | grep claude-code
anthropic.claude-code-2.1.220-darwin-arm64
anthropic.claude-code-2.1.224-darwin-arm64
anthropic.claude-code-2.1.232-darwin-arm64
anthropic.claude-code-2.1.235-darwin-arm64

$ du -shc ~/.vscode/extensions/anthropic.claude-code-* | tail -1
1.1G	total

登録されているのは1世代だけ

$ python3 -c "
import json
d=json.load(open('/Users/moha/.vscode/extensions/extensions.json'))
for e in d:
    if 'claude' in e['identifier']['id']:
        print(e['identifier']['id'], e['version'])
"
anthropic.claude-code 2.1.235

残り3世代の830MBは、VS Codeが参照していないディレクトリです。VS Codeは削除予定の拡張機能を.obsoleteに記録します。

$ python3 -m json.tool < ~/.vscode/extensions/.obsolete
{
    "charliermarsh.ruff-2026.68.0-darwin-arm64": true,
    "anthropic.claude-code-2.1.220-darwin-arm64": true,
    "charliermarsh.ruff-2026.70.0-darwin-arm64": true,
    "anthropic.claude-code-2.1.224-darwin-arm64": true,
    "openai.chatgpt-26.803.41515-darwin-arm64": true,
    "anthropic.claude-code-2.1.232-darwin-arm64": true,
    "openai.chatgpt-26.810.41047-darwin-arm64": true
}

3世代ともtrueで載ったまま、掃除されずにディスクだけ食っていました。1バージョンあたり254MBから309MBあるので、拡張機能を数回更新するだけで積み上がります。

消すときの判断基準

  • VS Codeを終了してから、.obsoletetrueで載っているディレクトリだけを削除する
  • extensions.json.obsoleteはVS Codeが管理する索引なので、手で編集しない

.obsoleteに載っていないディレクトリは現役です。バージョン番号の新旧だけで消すと、起動時に拡張機能が読み込めなくなります。

まとめ

  • VS Code拡張機能はresources/native-binary/claude(299MB)を同梱し、PATH上のCLIとは別経路で更新される
  • initialPermissionModeなど4項目はmachineスコープ、focusViewはapplicationスコープ。.vscode/settings.jsonに書いても読まれない
  • リポジトリで揃えたい設定は.claude/settings.json側に置く。拡張機能とCLIの両方が同じものを読む
  • !のbashショートカットとTab補完はCLI専用。要るときは統合ターミナルでclaudeを起動する
よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!
目次