Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Copy: Code ReferenceNew to Visual Studio Code? Get it now.
Copy: Code Reference

Copy: Code Reference

devmao

| (0) | Free
Copy file path and selected line range to clipboard (file:startLine-endLine)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Copy Code Reference

VS Code extension that copies a reference to the current file and selected line range to the clipboard.

Output format: path/to/file.ts:96-101 (or path/to/file.ts:96 when a single line is selected)

Default shortcut

OS Shortcut
macOS Cmd+Alt+C
Windows / Linux Ctrl+Alt+C

To change the shortcut, open Preferences > Keyboard Shortcuts (Cmd+K Cmd+S on macOS, Ctrl+K Ctrl+S on Windows/Linux), search for Copy Code Reference, and assign your preferred key combination.

How to run

  1. Open the copy-code-reference folder in VS Code (or Cursor).
  2. Press F5 to launch an Extension Development Host window.
  3. In the new window, open a file, select a range of lines, then run Command Palette → "Copy Code Reference (file:startLine-endLine)".

Install permanently

From this folder:

npm i -g @vscode/vsce
vsce package

Then install the generated .vsix via Extensions → ⋯ → Install from VSIX.

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