"Copy for Context" is a Visual Studio Code extension that allows you to quickly copy selected files as formatted markdown. This is particularly useful when you need to share code snippets with AI assistants like ChatGPT or Claude, or when you want to create documentation that includes code from multiple files.
-
Copy for Context:
- Select multiple files in the VS Code Explorer, right-click, and choose "Copy for Context."
- Automatically copies selected files as markdown to your clipboard.
- Includes file paths and automatically detects language for syntax highlighting.
-
Copy This File for Context:
- Right-click on any tab title or use the command palette to copy the active file as markdown.
-
Copy This Tab Group for Context:
- Right-click on any tab title or use the command palette to copy all files in the current tab group as markdown.
-
Copy All Open Tabs for Context:
- Use the command palette or right-click on any tab title to copy all open tabs as markdown.
-
Works with all file types supported by VS Code.
- Download the
.vsix
file from the releases page. - Open VS Code.
- Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X on Mac).
- Click on the '...' at the top of the Extensions view.
- Choose 'Install from VSIX...'.
- Select the downloaded
.vsix
file.
(Note: Include this section only if you've published to the VS Code Marketplace)
- Open VS Code.
- Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X on Mac).
- Search for "Copy for Context".
- Click "Install".
-
Copy for Context:
- In the VS Code Explorer, select one or more files you want to copy.
- Right-click on the selection.
- Choose "Copy for Context" from the context menu.
- The selected files will be copied to your clipboard as formatted markdown.
-
Copy This File for Context:
- Right-click on the tab title of the file you want to copy.
- Choose "Copy This File for Context" from the context menu.
- The file will be copied to your clipboard as formatted markdown.
-
Copy This Tab Group for Context:
- Right-click on the tab title of any file in the tab group.
- Choose "Copy This Tab Group for Context" from the context menu.
- All files in the tab group will be copied to your clipboard as formatted markdown.
-
Copy All Open Tabs for Context:
- Right-click on any tab title or use the command palette.
- Choose "Copy All Open Tabs for Context".
- All open tabs will be copied to your clipboard as formatted markdown.
-
Paste the content wherever you need it (e.g., in a conversation with an AI assistant).
When you copy files using this extension, the output will look something like this:
## File: src/example.js
Language: javascript
```javascript
function hello() {
console.log("Hello, world!");
}
```
Language: css
body {
font-family: Arial, sans-serif;
}
Currently, this extension does not require any configuration. It works out of the box!
(List any known issues or limitations here. If there are none, you can omit this section.)
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
If you encounter any problems or have any suggestions, please open an issue on the GitHub repository.
This project uses ESLint and Prettier for code linting and formatting. These checks are run in the CI pipeline for all pull requests.
To manually run linting:
npm run lint
To manually run formatting:
npm run format
Happy coding, and enjoy using Copy for Context!