A VS Code extension that copies and inserts code line references with hotkeys. Generate references in the format @filename.ext#L15 or @filename.ext#L15-20 and smartly insert them into side editors or terminals.
Based on Copy Line Reference by reily, with added features including terminal support, smart insertion, and configurable path formats.
Features
Copy references to code lines: @filename.ext#L15 or @filename.ext#L15-20
Copy file-only references: @filename.ext (when no text selected)
Smart insertion into side editors with context-aware spacing
Terminal integration - send references directly to active terminal
Configurable: relative paths (default) or absolute paths
Works with single lines or multi-line selections
Installation
Search for "Quick Line Ref" in the VS Code Extensions view (Ctrl+Shift+X) or install from the Visual Studio Marketplace.
Usage
Copy Line Reference
Hotkey: Ctrl+Alt+R (Windows/Linux) or Cmd+Alt+R (Mac)
Command Palette: "Copy Line Reference"
Insert Reference to Side Editor or Terminal
Hotkey: Ctrl+Alt+I (Windows/Linux) or Cmd+Alt+I (Mac)
Command Palette: "Insert Line Reference to Side Editor"
This feature works with:
Split Editor: Requires split editor view with two files open side-by-side
Terminal: Works with any active terminal
The extension intelligently chooses the target:
If a side editor is available, uses smart insertion logic
If no side editor but terminal is active, sends reference to terminal
References are inserted with appropriate spacing for continued typing
Examples
File only (cursor positioned but no text selected): @src/extension.ts
Single line selected: @src/extension.ts#L15
Line range selected: @docs/readme.md#L22-26
Extension Settings
copyLineReference.useAbsolutePath: Use absolute path instead of relative path for file references (default: false)
Requirements
VS Code 1.74.0 or higher
File must be in a workspace (for relative path mode)