Overview Version History Q & A Rating & Review
Copy Code Reference for AI
Copy code references — @src/foo.ts:10-20 (relative) or @/Users/you/project/src/foo.ts:10-20 (absolute) — straight to the clipboard, ready to paste into Claude Code, the built-in VS Code Chat, or any other AI input.
Works with both VS Code and Cursor.
Commands
Command
Default shortcut
Output
Copy Relative Code Reference for AI
Ctrl+Shift+C / Cmd+Shift+C
@src/foo.ts:10-20
Copy Absolute Code Reference for AI
Ctrl+Shift+Alt+C / Cmd+Shift+Alt+C
@/Users/you/project/src/foo.ts:10-20
Copy Remote Reference
—
https://github.com/owner/repo/blob/commit/path/file.ts#L10-L20
With just a caret (no selection), each command copies a single-line reference (e.g. @src/foo.ts:10).
All commands also appear in the editor's right-click menu under the Copy/Paste section.
Rebind either shortcut independently from VS Code's Keyboard Shortcuts UI.
The relative command falls back to the absolute path when the file is outside every workspace folder.
The remote reference command copies a GitHub/GitLab/Bitbucket permalink. After copying, a prompt offers to Open in Browser .
Settings
Setting
Type
Default
Description
copyCodeRefForAi.prefix
string
"@"
Prefix character (e.g. @ or #)
copyCodeRefForAi.pathLineSeparator
string
":"
Between path and line number
copyCodeRefForAi.lineRangeSeparator
string
"-"
Between start and end line
copyCodeRefForAi.remoteRef
string
"commit"
Remote reference type: "commit" (stable permalink) or "branch" (mutable)
Default: @src/foo.ts:10-20
Single line (no selection): @src/foo.ts:10
Absolute: @/Users/you/project/src/foo.ts:10-20
pathLineSeparator: "#": @src/foo.ts#10-20
Remote (GitHub): https://github.com/owner/repo/blob/abc123/path/file.ts#L10-L20
Example settings.json
{
"copyCodeRefForAi.prefix": "@",
"copyCodeRefForAi.pathLineSeparator": ":",
"copyCodeRefForAi.lineRangeSeparator": "-",
"copyCodeRefForAi.remoteRef": "commit"
}
Notes
Claude Code may auto-convert @file:line to @file#line — both formats resolve to the same lines.