Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Copy w/ LocationNew to Visual Studio Code? Get it now.
Copy w/ Location

Copy w/ Location

Serbyte Development

|
1 install
| (1) | Free
Copy selected code with its file path and line range.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

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.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft