LineClip
Quickly copy file path, line number, and line content to clipboard with a single click.
LineClip is a VS Code extension that helps you quickly copy code references for
sharing, documentation, or issue reporting. It's a port of the LineClip
JetBrains plugin with full feature parity.
Features
- 🎯 Right-click convenience: Access from the editor context menu
- 📋 Smart formatting: Copies in format:
relative/path/to/file.ext:42 line_content (or absolute path via alternate command)
- ✨ Clean output: Automatically trims leading and trailing whitespace
- 💬 Visual feedback: Status bar message shows preview of copied content
- ⌨️ Keyboard shortcut support: Configure your own shortcut (no default binding)
- 🗂️ Multi-root aware: Relative paths are resolved against the workspace folder that owns the file
Installation
Option 1: VS Code Marketplace
- Open VS Code
- Go to the Extensions view
- Search for "LineClip"
- Click Install
Option 2: Build from Source
Clone the repository, then from the project root:
npm install
npm run compile
npx @vscode/vsce package
The extension package will be created as lineclip-<version>.vsix
Install in VS Code
- Open the Extensions view
- Click the ... menu → Install from VSIX...
- Select the generated
.vsix file
Usage
- Right-click anywhere in the code editor
- Select "Copy Line Info" or "Copy Line Info (Abs Path)" from the context menu
- Paste anywhere to get the file path, line number, and content
Method 2: Keyboard Shortcut (Optional)
- Open Preferences → Keyboard Shortcuts
- Search for "Copy Line Info" or "Copy Line Info (Abs Path)"
- Click the + icon and set your preferred shortcut
Normal Lines
src/extension.ts:42 export function activate(context: vscode.ExtensionContext): void {
Empty Lines
src/extension.ts:15
Edge Cases
| Scenario |
Behavior |
| Empty line |
Copies path and line number only (no trailing spaces) |
| Very long line (500+ chars) |
Copies full line without truncation |
| Multi-root workspace |
Relative path is resolved against the workspace folder that owns the file |
| No active editor |
Command is a no-op |
Compatibility
- Platform: VS Code 1.85.0 or later
- Language: TypeScript
Development
Prerequisites
- Node.js 22 or later (required by
@vscode/test-electron 3.x)
Building
npm install
npm run compile # type-check + esbuild bundle
npm test # run tests via @vscode/test-electron + Mocha
npx @vscode/vsce package # produce a .vsix
Publishing a new release (Marketplace publisher account, tokens) is documented
separately in PUBLISHING.md.
Project Structure
lineclip/
├── src/
│ ├── extension.ts
│ └── lineInfoFormatter.ts
├── test/
│ ├── runTest.ts
│ ├── suite/
│ │ ├── index.ts
│ │ ├── lineInfoFormatter.test.ts
│ │ └── extension.test.ts
│ └── fixtures/workspace/sample.txt
├── images/
│ └── icon.png
├── package.json
├── esbuild.js
├── tsconfig.json
├── CHANGELOG.md
├── PUBLISHING.md
└── LICENSE
License
MIT License
Author
Created by JoyApps
Changelog
See CHANGELOG.md for the full version history.
Support
If you encounter any issues or have suggestions, please reach out at joyappsfeedback@hotmail.com.
Support LineClip
LineClip is free and ad-free. If you try opencode Go — a low-cost AI coding plan — through our link, both of us get a $5 usage credit when you subscribe.
Run LineClip: Support LineClip from the Command Palette to copy the link, or hide the section via the lineclip.hideSupportSection setting.
We earn a $5 credit if you subscribe via our link.