Skip to content

Repository files navigation

Copy w/ Location

CI License: MIT

Copy selected code with its file path and line range in one keystroke, or click.

Right-click to copy or use option+cmd+c shortcut

Copy w/ Location in the editor context menu

Copied Output w/ Line Range

Copy w/ Location output

src/components/Header.tsx#L13-17

const Brand = ({ name }: { name: string }) => (
  <a href="/" className="text-lg font-semibold tracking-tight">
    {name}
  </a>
);
  • Copy location and code together. No manual path lookup or line-number cleanup.
  • Keep the selected code unchanged. The extension adds only the location header and separator.
  • Use workspace-relative paths. Paths stay compact and portable between machines.
  • Works with multiple selections. Each non-empty selection gets its own location header.

Developed & maintained by Serbyte Development · GitHub

Usage

  • Highlight code in VS Code or Cursor.
  • Right-click the editor.
  • Run Copy w/ Location.

Copy w/ Location in the editor context menu

Shortcut:

  • macOS: Cmd+Option+C
  • Windows/Linux: Ctrl+Alt+C

Single-line selections use #L25. Multi-line selections use #L25-30.

Compatibility

Copy w/ Location supports desktop VS Code 1.85+ and Cursor using standard VS Code editor and clipboard APIs. It does not require workspace trust and has no runtime dependencies.

Development

npm install
npm test
npm run check
npm run package

Support

For bugs or focused feature requests, see SUPPORT.md.

License

MIT.

About

Copy selected code with its file path and line range.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages