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

Copy With Location

Serbyte Development

|
3 installs
| (1) | Free
Copy selected code with its workspace-relative file path and line range for AI chats, code reviews, and bug reports.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Copy With Location

CI License: MIT Visual Studio Marketplace Version Open VSX Version

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

Right-click to copy or use Option+Cmd+C shortcut

Copy With Location in the editor context menu

Copied Output With Line Range

Copy With 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
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft