Lineno Copy
A small VS Code/Cursor extension for copying source locations in a CLI-friendly format.
Default copied locations:
src/app.ts:12
src/app.ts:12-18
Use it when you want to paste exact code locations into Codex CLI, Claude Code, Gemini CLI, Aider, or any other terminal-based coding assistant.
Commands
| Command |
Shortcut |
Output |
Lineno Copy: Copy Location |
Ctrl+Alt+C / macOS Cmd+Alt+C |
path:line or path:start-end |
Lineno Copy: Copy Location with Prompt |
Ctrl+Alt+Shift+C / macOS Cmd+Alt+Shift+C |
path:line / path:start-end plus a configurable fixed prompt |
The commands are also available from the editor context menu, command palette, and the status bar copy button.
Default prompt output
src/app.ts:12-18
Please explain the meaning, purpose, and role of the code at the referenced location(s) in this codebase.
This prompt is controlled by linenoCopy.promptText.
Behavior
- Empty selection: copies the current cursor line.
- Multi-line selection: copies a line range.
- Multiple selections/cursors: copies one location per selection by default.
- Workspace-relative paths are used by default, because CLI tools usually run from the project root.
- Whole-line mouse selections that end at column 0 of the next line are normalized to the intended selected lines.
Settings
| Setting |
Default |
Purpose |
linenoCopy.pathStyle |
relative |
Use relative or absolute paths. |
linenoCopy.includeWorkspaceFolder |
false |
Prefix relative paths with the workspace folder name. Useful for multi-root workspaces. |
linenoCopy.useForwardSlashes |
true |
Normalize path separators to /. |
linenoCopy.referencePrefix |
empty |
Add a prefix before each location, such as @. |
linenoCopy.copyAllSelections |
true |
Copy all selections/cursors instead of only the primary selection. |
linenoCopy.includeColumnNumbers |
false |
Include start/end columns. |
linenoCopy.promptText |
English explanation prompt |
Fixed prompt text used by Copy Location with Prompt. |
linenoCopy.copyNotification |
statusBar |
Use statusBar, information, or none. |
linenoCopy.showStatusBarButton |
true |
Show or hide the status bar copy button. |
linenoCopy.promptText normally behaves as fixed text appended after the location(s). If it contains placeholders, it becomes the full output template.
Supported placeholders: {reference}, {references}, {file}, {line}, {lineRange}.
Example template:
Explain this code and suggest safe refactors:
{references}
Publishing
Package the extension:
npx @vscode/vsce package --no-dependencies
Publish to VS Code Marketplace:
npx @vscode/vsce publish --packagePath lineno-copy-0.1.0.vsix
The VS Code Marketplace extension ID is:
JackMa-Tools.lineno-copy
Publish to Open VSX, if needed for Cursor / Open VSX users:
npx ovsx publish lineno-copy-0.1.0.vsix -p <token>
License
MIT