Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Copy Code RefNew to Visual Studio Code? Get it now.
Copy Code Ref

Copy Code Ref

Bruno Orlandi

|
2 installs
| (0) | Free
Copy a code reference (@file:line) to the clipboard with one shortcut.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Copy Code Ref icon

Copy Code Ref — VS Code Extension

Copy a code reference — file path + line range — to your clipboard with one shortcut.

VS Code Marketplace Installs

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.

Copy Code Reference in the context menu

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:

  1. Right-click a text selection → "Copy Code Reference"
  2. Keyboard shortcut: Ctrl+I (Windows/Linux) / Cmd+I (macOS) with text selected
  3. Command Palette (Ctrl+Shift+P / Cmd+Shift+P): "Copy Code Reference"

After copying, a brief status bar message confirms the reference is in your clipboard.

Requirements

  • VS Code 1.85.0 or later (or Cursor)
  • A workspace folder must be open (the extension uses the workspace root to compute relative paths)

Notes

  • Works with any file type — no language restriction
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft