Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Copy Path for Claude Code (VS Code)New to Visual Studio Code? Get it now.
Copy Path for Claude Code (VS Code)

Copy Path for Claude Code (VS Code)

teppasit

|
217 installs
| (2) | Free
VS Code extension that copies file/folder references in Claude Code @-mention format (@path/to/file#L42-68)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Copy Path for Claude Code

Copy file and folder references in Claude Code @-mention format directly from your IDE. Press ⌥C (Alt+C) or right-click — works in both the editor and the file tree:

  • Editor (line selected): @src/auth.ts#L42-68
  • Editor (no selection): @src/auth.ts
  • File tree (file): @src/components/Button.tsx
  • File tree (folder): @src/components/

Paste straight into Claude Code and it knows exactly which file and lines you mean.

Features

Feature Details
File & folder paths Copies relative path in @path format
Line selection Adds #L42 or #L42-68 based on selection
Spaces in paths Auto-wraps in double quotes: @"my file.ts"
Folder trailing slash @src/components/ distinguishes folders from files
Multi-cursor Each caret generates a separate reference
Multi-file selection Select multiple files/folders and copy all at once
Configurable output Trailing space, separator, and notification options

Reference Format

Context Output
File (no selection) @src/utils/auth.ts
File (single line selected) @src/utils/auth.ts#L42
File (multiple lines selected) @src/utils/auth.ts#L42-68
File with spaces in path @"my file.ts"
File with spaces + line range @"my file.ts#L42-68"
Folder @src/components/
Folder with spaces @"my components/"
Multi-cursor (carets only) @src/utils/auth.ts#L5 @src/utils/auth.ts#L42
Multi-cursor (with selections) @src/utils/auth.ts#L5-10 @src/utils/auth.ts#L30-35
Multiple files selected @src/Button.tsx @src/Input.tsx

How to Use

  • Editor context menu — Right-click in any editor → Copy Path for Claude Code. The reference includes line numbers based on your current text selection.
  • File tree context menu — Right-click any file or folder in the Explorer panel → Copy Path for Claude Code. Copies the relative path without line numbers.
  • Keyboard shortcut — Press Alt+C (⌥C on macOS). Works in both the editor and file tree; the output adapts automatically based on focus and selection.
Context Shortcut (Windows/Linux) Shortcut (macOS) Behavior
Editor (no selection) Alt+C ⌥C Copy file path
Editor (with selection) Alt+C ⌥C Copy with line range
File tree Alt+C ⌥C Copy selected file/folder paths

Examples

  1. Select lines 10–25 in src/components/Button.tsx, press ⌥C → @src/components/Button.tsx#L10-25
  2. Right-click package.json in the file tree → @package.json
  3. Right-click src/components folder → @src/components/
  4. Right-click my components folder (with spaces) → @"my components/"
  5. Right-click my file.ts (with spaces) → @"my file.ts"
  6. Select lines 5–10 in my file.ts (with spaces), press ⌥C → @"my file.ts#L5-10"
  7. Place caret without selecting text, press ⌥C → @src/index.ts (path only)
  8. Place multiple cursors (Alt+Click) on lines 5, 20, 42, press ⌥C → @src/utils/auth.ts#L5 @src/utils/auth.ts#L20 @src/utils/auth.ts#L42
  9. Select text at multiple cursors (e.g. lines 5–10 and 30–35), press ⌥C → @src/utils/auth.ts#L5-10 @src/utils/auth.ts#L30-35

Settings

Open Settings (Ctrl+,) and search for Copy Path for Claude Code, or add to settings.json:

"copyPathForClaudeCode.appendTrailingSpace": true,
"copyPathForClaudeCode.multipleReferencesSeparator": "Space",
"copyPathForClaudeCode.showNotification": true
Setting Type Default Description
appendTrailingSpace boolean true Add a space after the copied reference for easy pasting
multipleReferencesSeparator "Space" | "Newline" "Space" Separator between multiple references
showNotification boolean true Show notification after copying

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft