Copy a Claude Code-friendly reference to the lines you
have highlighted, so you can paste it straight into a Claude Code prompt as an
@-mention.
@src/utils/parser.ts#L12-L30
| Situation | Result |
|---|---|
| Multi-line selection | @src/utils/parser.ts#L12-L30 |
| Single line | @src/utils/parser.ts#L12 |
| No selection (caret only) | @src/utils/parser.ts |
| Multiple selections / multi-cursor | one reference per selection, newline-separated |
The path is computed with VS Code's workspace-relative resolver: in a multi-root workspace it includes the folder name, and if the file lives outside every workspace folder it falls back to the absolute path.
Note on line counting: the end line is reported exactly as VS Code reports the end of the selection. Selecting all of lines 12–14 (where the caret lands at the start of line 15) reports
#L12-L15.
| Command | Keybinding (macOS / other) | Description |
|---|---|---|
Copy Code Reference |
⌘L / Ctrl+L |
Workspace-relative path |
Copy Code Reference (Absolute Path) |
⌘⇧L / Ctrl+Shift+L |
Absolute path |
Both are also available from the Command Palette (⇧⌘P) under Copy Code Reference.
The default keybindings intentionally shadow VS Code's built-in Expand Line Selection (
⌘L) and Select All Occurrences (⌘⇧L) while the editor is focused. Rebind them in Preferences → Keyboard Shortcuts if you want those back.
A status-bar message confirms exactly what was copied.
npm install
npm run compile # tsc → out/
npm test # compiles, then runs node:test against out/Press F5 to launch the Extension Development Host and try the commands.
The icon is authored as icon.svg and rendered to icon.png (128×128). To regenerate:
rsvg-convert -w 128 -h 128 icon.svg -o icon.png
# or, without rsvg-convert installed:
npx svgexport icon.svg icon.png 128:128Published under the chanwutk publisher / namespace. Build the package first:
npm run package # → code-line-copy-<version>.vsixVS Code forks pull from Open VSX rather than Microsoft's Marketplace.
-
Sign in at https://open-vsx.org with GitHub, then sign the Eclipse Foundation Publisher Agreement (one-time, linked from your user settings).
-
Create an access token in your open-vsx.org user settings.
-
Create the namespace once, then publish:
export OVSX_PAT='your-open-vsx-token' # ovsx reads this automatically npx ovsx create-namespace chanwutk # one-time npm run publish:ovsx # ovsx publish (or: npx ovsx publish <file>.vsix)
-
Create a publisher at https://marketplace.visualstudio.com/manage (requires a Microsoft account; the token comes from an Azure DevOps organization).
-
Generate an Azure DevOps Personal Access Token scoped to Marketplace → Manage for all accessible organizations.
-
Log in and publish:
npx @vscode/vsce login chanwutk # paste the PAT npm run publish # vsce publish
code --install-extension code-line-copy-0.0.1.vsix- Auto-publish via GitHub Actions on tags. Add a workflow that triggers on
version tags (e.g.
v0.0.2): runnpm test, build withnpm run package, then publish to Open VSX (ovsx publish) and the VS Code Marketplace (vsce publish). StoreOVSX_PATandVSCE_PATas repository secrets. - Publish to the VS Code Marketplace. Currently published to Open VSX only; complete the Marketplace publisher setup and first publish (see above).
MIT © 2026 chanwutk