Copy a code reference — file path + line range — to your clipboard with one shortcut.
Select any code in the editor and instantly get a reference like @src/auth.ts:12-25 ready to paste into pull requests, docs, Notion, Slack, Linear, or AI chats.
What it copies
Multi-line selection:
@src/auth.ts:12-25
Single-line selection:
@src/auth.ts:12
Format options
Configure via copyCodeRef.format in VS Code settings:
Format
Example
Style
default
@src/auth.ts:12-25
Cursor / VS Code / terminal
github
@src/auth.ts#L12-L25
GitHub
gitlab
@src/auth.ts#L12-25
GitLab
Installation
Search for "Copy Code Ref" in the VS Code Marketplace or install from the Extensions tab (Ctrl+Shift+X / Cmd+Shift+X).
Also compatible with Cursor.
Usage
Three ways to invoke:
Right-click a text selection → "Copy Code Reference"
Keyboard shortcut: Ctrl+I (Windows/Linux) / Cmd+I (macOS) with text selected