A VS Code extension that copies references to selected lines of code with a hotkey.
- Copy references to code lines in the format
@filename.ext#L15or@filename.ext#L15-20 - Copy file-only references
@filename.extwhen no specific line is focused - Works with single lines or multi-line selections
- Uses relative paths from workspace root
- Smart insertion into side editors or terminals
- Available via hotkey or Command Palette
Hotkey: Ctrl+Alt+R (Windows/Linux) or Cmd+Alt+R (Mac)
Command Palette: "Copy Line Reference"
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 - simply appends the reference
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
- 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
- Download the
.vsixfile - In VS Code, go to Extensions view (
Ctrl+Shift+X) - Click the "..." menu and select "Install from VSIX..."
- Select the downloaded file
- VS Code 1.74.0 or higher
- File must be in a workspace (not standalone files)
This extension contributes no additional settings.
- Documentation Update: Ensure marketplace displays latest README with complete feature documentation
- Terminal Support: Insert references directly into active terminal
- Smart Target Detection: Automatically chooses between side editor and terminal
- Enhanced Integration: References appended to terminal with trailing space for continued typing
- New Keyboard Shortcuts: Changed to
Cmd+Alt+RandCmd+Alt+I(less likely to conflict) - Smart Insertion Logic: Context-aware insertion with proper spacing
- Blank lines: Insert reference + space
- End of words: Add proper spacing around reference
- Mid-word: Move to word end first, then insert
- Always adds trailing space for continued typing
- Fixed Line Number Logic: Line numbers only included when text is actually selected
- File-Only References: Cursor positioning alone returns file path only (
@file.ext) - Improved Behavior: More intuitive reference generation
Initial release with basic line reference copying functionality.