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

Copy Path for Claude Code

arx8

|
38 installs
| (1) | Free
Copy the active file path in Claude Code @path format to the clipboard, with optional line numbers.
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 Path for Claude Code

VS Code extension that copies the active file path in Claude Code's @path format to the clipboard.

Install from VS Code Marketplace

Demo

Demo

Why?

Claude Code for VS Code has a built-in command Claude Code: Insert @-Mention Reference — which would make this extension completely unnecessary. Unfortunately, it still doesn't work in some environments

The issues below are closed, but the command still doesn't work in my environment for months. e.g.

  • [BUG: VSCode Extension: "Insert @-Mention Reference" and "Insert At-Mentioned" keyboard shortcuts not working on Windows (v2.1.7) · Issue #18083 · anthropics/claude-code](https://github.com/anthropics/claude-code/issues/18083)
  • [BUG: Insert At-Mentioned doesn't work anymore in VSCode Version: 1.108.0 · Issue #18126 · anthropics/claude-code](https://github.com/anthropics/claude-code/issues/18126)

So here we are. 🫠

If you're in the same boat, this extension has your back until the official command is fixed. 🫰

Features

  • Copy Relative Path — Copies @relative/path/to/file.ts to clipboard
  • Copy Absolute Path — Copies @/absolute/path/to/file.ts to clipboard
  • Line number support — When text is selected, appends line numbers automatically
    • Single line: @path#5
    • Range: @path#5-10
  • Multi-cursor support — With multiple cursors, copies all positions as a markdown list
    - @path#3
    - @path#10
    - @path#25
    
  • Explorer context menu — Right-click files or directories in the file explorer to copy paths
    • Directories get a trailing slash: @src/components/
    • Multi-selection copies a bullet list:
      - @src/foo.ts
      - @src/bar/
      

A trailing space (or newline for multi-line) is included, so you can start typing right after pasting. 📑

Usage

From the editor

  1. Open a file in the editor
  2. Open the Command Palette (Cmd+Shift+P or Ctrl+Shift+P)
  3. Run one of:
    • Copy Relative Path for Claude Code
    • Copy Absolute Path for Claude Code
  4. Paste the result into Claude Code

Optionally, select text before copying to include line numbers.

From the file explorer

  1. Right-click a file or directory (or select multiple items) in the file explorer
  2. Select Copy Relative Path for Claude Code or Copy Absolute Path for Claude Code
  3. Paste the result into Claude Code

Configuration

Setting Type Default Description
copy-path-for-claude-code.sortPaths boolean false When enabled, sort multi-item copy output alphabetically by path and numerically by line number.
copy-path-for-claude-code.stripPrefix string "" A prefix to strip from the beginning of copied relative paths. Useful for monorepo setups (e.g., set to "root/" to turn @root/src/index.ts into @src/index.ts).

Keyboard Shortcuts

Note: Keyboard shortcuts only work when an editor has focus (VS Code API limitation). When the Explorer is focused, use the right-click context menu instead.

This extension does not register default keybindings. To set your own:

  1. Open the Command Palette (Cmd+Shift+P or Ctrl+Shift+P)
  2. Run Preferences: Open Keyboard Shortcuts
  3. Search for Copy Path for Claude Code
  4. Click the pencil icon next to the command and assign your preferred shortcut
Command Command ID
Copy Relative Path for Claude Code copy-path-for-claude-code.copyRelativePath
Copy Absolute Path for Claude Code copy-path-for-claude-code.copyAbsolutePath

You can also edit keybindings.json directly. For example:

[
  {
    "key": "ctrl+shift+c",
    "command": "copy-path-for-claude-code.copyRelativePath",
    "when": "editorTextFocus"
  }
]

Requirements

  • VS Code 1.109.0 or later

License

MIT

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