Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Copy with File PathNew to Visual Studio Code? Get it now.
Copy with File Path

Copy with File Path

yutakahashi114

|
3 installs
| (1) | Free
Copy selected text along with file path information
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Copy with File Path

https://github.com/yutakahashi114/copy-with-file-path

A Visual Studio Code extension that copies selected text along with file path information to the clipboard.

Features

This extension provides the following functionality:

  • Copy with File Path: Copy selected text along with the relative file path and line number information
  • Multiple copy modes:
    • If no text is selected: Copies file path with current line number
    • If single line is selected: Copies file path, line number, and selected text
    • If multiple lines are selected: Copies file path, line range, and selected text

Usage

  1. Select text in the editor (optional)
  2. Right-click and select "Copy with File Path" from the context menu
  3. Or use the keyboard shortcut: Cmd+Alt+C (Mac) / Ctrl+Alt+C (Windows/Linux)
  4. The text with file path information is copied to your clipboard

Example Output

  • No selection: src/extension.ts (line 15)
  • Single line: src/extension.ts (line 15) const editor = vscode.window.activeTextEditor;
  • Multiple lines:
    src/extension.ts (lines 15-17)
    const editor = vscode.window.activeTextEditor;
    if (!editor) {
        return;
    }
    

Requirements

  • Visual Studio Code 1.101.0 or higher

Extension Settings

This extension does not contribute any VS Code settings.

Known Issues

Currently, there are no known issues.

Release Notes

0.0.1

Initial release of Copy with File Path extension featuring:

  • Copy selected text with file path and line number information
  • Support for multiple copy modes (no selection, single line, multiple lines)
  • Keyboard shortcut and context menu integration

Development

Building the Extension

# Install dependencies
npm install

# Compile the extension
npm run compile

Testing

# Run tests
npm run test

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This extension is released under the MIT License.

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