A practical VS Code extension that helps developers quickly copy file names and line numbers, especially useful for code positioning when collaborating with AI assistants.
- ⚡ One-Click Copy - Quickly copy file names and line numbers after selecting code
- 🎯 Multiple Formats - Supports 4 output formats for different scenarios
- 🔧 Highly Configurable - Customizable keyboard shortcuts and output formats
- 🤝 AI-Friendly - Designed specifically for code positioning when collaborating with AI
- 📋 Context Menu - Supports right-click menu and editor title bar buttons
- Open VS Code
- Press
Cmd+Shift+P(Mac) orCtrl+Shift+P(Windows/Linux) - Type "Extensions: Install Extensions"
- Search for "Copy Line"
- Click Install
- Download the
.vsixfile - Press
Cmd+Shift+Pin VS Code - Type "Extensions: Install from VSIX"
- Select the downloaded file
- Mac:
Cmd + Option + L - Windows/Linux:
Ctrl + Alt + L
- Select code in the editor (supports multi-line selection and multi-cursor selection)
- Press the keyboard shortcut or select "Copy Selected File and Line Numbers" from the context menu
- File name and line numbers are copied to the clipboard, ready to paste to AI
File: src/extension.ts (line 24-30)
src/extension.ts:24-30
src/extension.ts:24:30
在 src/extension.ts 的第 24-30 行
Search for "Copy Line" in VS Code settings to find all configuration options:
Output format type, default: labeled
labeled:File: src/file.ts (line 24-30)compact:src/file.ts:24-30code-style:src/file.ts:24:30natural:在 src/file.ts 的第 24 行
Whether to use absolute paths, default: false
false: Use relative paths (relative to workspace root)true: Use absolute paths
Whether to show status bar message after copying, default: true
Format template for single line selection, default: line ${line}
- Available variables:
${line},${start},${end}
Format template for multi-line selection, default: line ${start}-${end}
- Available variables:
${line},${start},${end}
Tell AI the code location you want to discuss:
Input to AI:
Please help me optimize this code:
File: src/extension.ts (line 24-30)
AI Understands:
Needs to review lines 24-30 of the src/extension.ts file
Quickly locate code that needs review:
Needs review:
File: src/service/user.ts (line 45-67)
File: src/utils/helper.ts (line 12)
Report problematic code to your team:
Bug found:
File: src/api/client.ts (line 88-95)
{
"copy-line.outputFormat": "natural",
"copy-line.useAbsolutePath": true,
"copy-line.singleLineFormat": "第 ${line} 行",
"copy-line.multiLineFormat": "第 ${start} 到 ${end} 行",
"copy-line.showStatusMessage": false
}If the default keyboard shortcut conflicts, you can customize it in VS Code:
- Open
File > Preferences > Keyboard Shortcuts - Search for "复制选中文件与行号"
- Click to edit and set a new keyboard shortcut
Issues and Pull Requests are welcome!
- Clone the repository
- Run
npm install - Press
F5to start debugging - Test features in the new window
MIT License - See LICENSE file for details
If this extension helps you, please give it a ⭐!
Enjoy collaborating with AI! 🚀