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
Highlight lines in the editor.
Run the command palette command Copy Referenced Lines (or bind it to a shortcut).
The referenced lines (or the line at the cursor, if nothing is highlighted) is copied to the clipboard.
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.