A VS Code extension that helps you quickly copy code context - including file paths, contents, and workspace problems. Perfect for sharing context with AI coding assistants like Claude Code, GitHub Copilot, or ChatGPT. Just hit a key and paste!
Inspired by https://github.com/ArturoDent/problems-copy https://github.com/tsmith165/copy_file_path_and_contents
- Copy Current File Path and Content - Copy the active file's path and full content to clipboard
- Copy All Open Tabs Path and Content - Copy all open tabs with their paths and contents
- Copy All Open Tabs Paths (All Groups) - Copy file paths from all open tabs across all editor groups
- Copy All Open Tabs Paths (First Group) - Copy file paths from tabs in the first editor group only
- Copy All Open Tabs Paths (Second Group) - Copy file paths from tabs in the second editor group only
- Copy All Open Tabs Paths (Third Group) - Copy file paths from tabs in the third editor group only
- Copy All Current VS Code Problems - Copy all problems/diagnostics from the VS Code Problems panel
- Copy Current File Problems Only - Copy problems/diagnostics from the current file only
ctrl+alt+c- Copy current file path and contentctrl+alt+a- Copy all open tabs path and contentctrl+alt+shift+k- Copy all tabs paths (all groups)ctrl+alt+shift+p- Copy all current VS Code problemsctrl+alt+p- Copy current file problems only
Tip: To see all available commands and their keybindings, open the Command Palette (
Ctrl+Shift+PorCmd+Shift+P) and search for "code context copy"
-
Install VS Code Extension Manager (vsce)
npm install -g @vscode/vsce
-
Package the Extension Create a .vsix file:
vsce package
- Open VS Code, Cursor, or any VS Code fork
- Go to the Extensions panel (
Ctrl+Shift+XorCmd+Shift+X) - Click on the three dots (
...) menu at the top of the Extensions panel - Select "Install from VSIX..."
- Navigate to and select the generated .vsix file
- The extension will be installed and ready to use
- Use
ctrl+alt+ckeyboard shortcut - Current file's path and content will be copied to clipboard
- Use
ctrl+alt+akeyboard shortcut - All open tabs will be copied with their paths and contents
- Use
ctrl+alt+shift+pkeyboard shortcut - All current problems (errors, warnings, hints) shown in the VS Code Problems panel will be copied in a simple format:
Error, src/file.js, "Syntax error", eslint(semi), [10:5] Warning, lib/utils.ts, "Variable never used", typescript(6133), [25:10]
- Open a file with problems/diagnostics
- Use
ctrl+alt+pkeyboard shortcut - Problems from the current file only will be copied in the same simple format
- Use
ctrl+alt+shift+kto copy paths from all open tabs across all editor groups - Or use the command palette to copy paths from specific groups:
- "Code Context Copy: All Open Tabs Paths (First Group)"
- "Code Context Copy: All Open Tabs Paths (Second Group)"
- "Code Context Copy: All Open Tabs Paths (Third Group)"
- Tab paths will be copied to clipboard, one per line
The problems output format includes:
- Severity (Error, Warning, Information, Hint)
- File path (relative to workspace)
- Error message (in quotes)
- Source and code (e.g., eslint(no-unused-vars))
- Line and column position [line:column]
Visual Studio Code allows you to set custom keybindings for extension commands directly within the IDE. To customize the keybindings for "Copy File Path and Content" commands:
- Open the Keyboard Shortcuts editor in VS Code by going to "File" > "Preferences" > "Keyboard Shortcuts"
- Search for the desired command using: "extension.copy"
- Click on the "Keybinding" cell for the command you want to edit the shortcut for.
- Press the desired key combination for the custom keybinding.
- If there are any conflicts with existing keybindings, VS Code will prompt to resolve them.
- The custom keybinding will be added to your keybindings.json file.
Feel free to customize the keybindings to suit your preferences!
Happy coding!
