Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Line Reference CopierNew to Visual Studio Code? Get it now.
Line Reference Copier

Line Reference Copier

Ray Lee

|
1 install
| (0) | Free
Copy file line ranges referenced like (@file:10-20) to the clipboard and optionally send them to the terminal.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Line Reference Copier

This lightweight VS Code extension copies the text you have selected—or resolves references like (@file:10-20) and @src/app/page.tsx:5-12—into your clipboard, and optionally pushes the snippet into the active terminal.

Usage

  1. Highlight lines in the editor.
  2. Run the command palette command Copy Referenced Lines (or bind it to a shortcut).
  3. The referenced lines (or the line at the cursor, if nothing is highlighted) is copied to the clipboard.
  4. When prompted, choose Send Reference to Terminal if you also want an @path:start-end reference (not the copied content) sent into the current integrated terminal.

Configuration

Add the following setting to automatically send references to your terminal without seeing the prompt:

"lineReference.autoSendToTerminal": true

Reference Rules

  • @file refers to the currently active editor document.
  • Any other path is treated as workspace-relative (e.g. @src/lib/utils.ts:14-22).
  • Absolute paths also work (@/Users/name/project/file.ts:8-9).
  • Single line ranges are allowed: (@file:42) copies just line 42.

Packaging

To bundle the extension into a VSIX, run from this folder:

npm install --no-save @vscode/vsce
npm run package

The VSIX can then be installed with code --install-extension <file>.vsix.

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