A VS Code extension that makes it easy to insert file paths and code selection references into Claude Code or Codex's chat input. Claude Code uses the @mention format while Codex uses structured file attachments.
Right-click a file in the Explorer or use the editor toolbar button to instantly insert a file reference into Claude Code's chat input.
- Explorer Context Menu: Right-click any file → "Add File to Claude Code"
- Editor Toolbar Button: "Add File to Claude Code" button in the editor title bar submenu
- Supports multi-file selection (Ctrl+Click multiple files)
- Folders are referenced with trailing slash (
@src/components/) - References use relative paths:
@src/utils/helper.ts
Select lines in the editor and insert them as a code reference into Claude Code's chat.
- Editor Context Menu: Select text → Right-click → "Add Selection to Claude Code"
- Editor Toolbar Button: "Add Selection to Claude Code" button in the submenu (appears when text is selected)
- References include line numbers:
@src/app.ts#5-10 - Direct insertion into Claude Code (when installed) — no paste needed
- Fallback to clipboard if Claude Code extension is not available
Right-click a file in the Explorer to add it as a structured attachment to Codex's chat.
- Explorer Context Menu: Right-click any file → "Add File to Codex"
- Editor Toolbar Button: "Add File to Codex" button in the editor title bar submenu
- Supports multi-file selection (Ctrl+Click multiple files)
- Files are added directly as attachments (no
@mentionformat needed) - Fallback to
@mentionformat clipboard if Codex extension is not available
Select lines in the editor and add them as context to Codex's chat.
- Editor Context Menu: Select text → Right-click → "Add Selection to Codex"
- Editor Toolbar Button: "Add Selection to Codex" button in the submenu (appears when text is selected)
- Selection is added directly to Codex's chat context
- Fallback to
@file#line-rangeclipboard format if Codex extension is not available
cd ClaudeCodeExtensionExtension
npm install
npm run compile
npx @vscode/vsce packageThis creates a claude-code-helper-for-vscode-0.0.1.vsix file.
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Click the three dots menu (top-right)
- Select Install from VSIX...
- Navigate to and select the
.vsixfile from your project folder
The extension will now be installed and available every time you start VS Code.
- VS Code 1.85.0 or later
- Claude Code extension (optional, for seamless Claude Code insertion)
- Codex extension by OpenAI (optional, for Codex file attachment support)
- Explorer: Right-click a file → "Add File to Claude Code"
- Or: Click the
@mentionicon in the editor toolbar → "Add File to Claude Code"
- Or: Click the
- If Claude Code is installed, the reference is inserted directly into the chat input
- Otherwise, reference is copied to clipboard — press
Ctrl+Vin Claude Code to paste
- Editor: Select lines of code
- Right-click → "Add Selection to Claude Code"
- Or: Click the
@mentionicon in the editor toolbar → "Add Selection to Claude Code"
- Or: Click the
- Reference is inserted directly into Claude Code's chat input if available
- If Claude Code not installed: reference copied to clipboard — press
Ctrl+Vto paste
- Explorer: Right-click a file → "Add File to Codex"
- Or: Click the
@mentionicon in the editor toolbar → "Add File to Codex"
- Or: Click the
- If Codex is installed, the file is added directly as a chat attachment and the sidebar opens
- Otherwise, reference is copied to clipboard (
@mentionformat) — pressCtrl+Vin Codex to paste
- Editor: Select lines of code
- Right-click → "Add Selection to Codex"
- Or: Click the
@mentionicon in the editor toolbar → "Add Selection to Codex"
- Or: Click the
- If Codex is installed, the selection is added to the chat context
- If Codex not installed: reference copied to clipboard — press
Ctrl+Vto paste
The extension generates references in Claude Code's native @mention format:
| Reference | Example |
|---|---|
| Whole file | @src/utils/helper.ts |
| Single line | @src/app.ts#42 |
| Line range | @src/app.ts#5-10 |
| Folder | @src/components/ |
Codex uses structured file attachments (when extension is installed):
- Files are added as chat attachments, not as text references
- Selections are added as chat context
- Fallback to
@mentionformat (same as Claude Code) if Codex extension not available
- ✅ Files outside workspace (skipped with warning)
- ✅ Multi-root workspaces (each file resolved to its workspace root)
- ✅ Multiple file selection (joined with spaces for Claude Code, individual calls for Codex)
- ✅ No workspace folder (error message)
- ✅ Windows path separators (automatically converted to forward slashes)
- ✅ Virtual filesystems (skipped gracefully)
- ✅ Readonly files (toolbar button hidden)
- ✅ Claude Code not installed (falls back to clipboard)
- ✅ Codex not installed (falls back to clipboard)
Configure the extension via settings.json:
"claudeCodeHelper.showStatusBarMessage": truetrue(default): Show status bar message after copying referencesfalse: Silent operation (no status bar feedback)
- Node.js 18+
- npm
cd ClaudeCodeExtensionExtension
npm install
npm run compilePress F5 to launch the Extension Development Host. This opens a new VS Code window with the extension loaded.
npm run compile # Compile TypeScript
npm run watch # Watch for changes (auto-compile)
npm run vscode:prepublish # Prepare for publishingTo create a .vsix package for distribution:
npx @vscode/vsce packageIn the Extension Development Host:
-
Test Explorer File Reference:
- Right-click a file in Explorer
- Verify "Add File to Claude Code" appears
- Click it and (if Claude Code open) verify input gets focus
- Otherwise check clipboard contains
@relative/path
-
Test Multiple Files:
- Ctrl+Click multiple files in Explorer
- Right-click and select command
- If Claude Code open: verify files inserted
- Otherwise: verify clipboard contains
@file1 @file2
-
Test Selection Reference:
- Select lines in editor
- Right-click → "Add Selection to Claude Code"
- If Claude Code open: reference appears in chat input
- Otherwise: check clipboard for
@file#start-end
-
Test Codex File Reference:
- Right-click a file in Explorer
- Verify "Add File to Codex" appears
- If Codex installed: Codex sidebar should open with file attached
- Otherwise: clipboard contains
@relative/path
-
Test Codex Multiple Files:
- Ctrl+Click multiple files in Explorer
- Right-click → "Add File to Codex"
- If Codex installed: verify all files are attached to chat
- Otherwise: verify clipboard contains
@file1 @file2
-
Test Codex Selection Reference:
- Select lines in editor
- Right-click → "Add Selection to Codex"
- If Codex installed: Codex sidebar opens with selection added
- Otherwise: check clipboard for
@file#start-end
-
Test Toolbar Buttons:
- Click
@mentiondropdown in editor toolbar - Verify all 4 commands appear (Claude file, Claude selection, Codex file, Codex selection)
- Verify Claude items grouped separately from Codex items
- Click
-
Test Edge Cases:
- Right-click folder → reference ends with
/ - Right-click file outside workspace → warning shown
- Use commands with no workspace → error shown
- Right-click folder → reference ends with
- Ensure Claude Code extension is installed
- Claude Code's input panel must be open/focused
- Try pressing
Ctrl+Vto paste if using clipboard mode
- Ensure Codex extension by OpenAI is installed
- Codex's sidebar must be visible (or will open automatically)
- Try pressing
Ctrl+Vto paste if using clipboard mode - Check that Codex extension is enabled (not disabled)
- Commands appear in context menus when conditions are met (selection required for selection commands)
- Toolbar
@mentiondropdown only shows for file documents (not settings/output panels) - Selection commands hidden when no text is selected
- Try reloading the window (Cmd+Shift+P → "Developer: Reload Window")
- Make sure you have a workspace folder open (not single file)
- Files must be within an open workspace folder
- Check the error message for details
- Claude Code extension ID:
github.copilot-chat - Codex extension ID:
openai.chatgpt - Verify both are installed via Extensions panel (Ctrl+Shift+X)
Found a bug or have a feature request? Please open an issue on GitHub.
MIT

