Copy as Context

Easily copy entire folder structures and their contents into your clipboard, perfectly formatted for Large Language Models (LLMs) like ChatGPT, Claude, and Gemini.
Stop manually copying and pasting individual files! With a single click, you can provide an LLM with the complete context of a project folder, including the directory tree and the code within each file.
The Problem
When you need to ask an AI about a multi-file project, you face a tedious process:
- Describe the folder structure manually.
- Copy the contents of
file1.js
.
- Paste it.
- Copy the contents of
file2.ts
.
- Paste it.
- ...and so on.
This is slow, error-prone, and wastes your valuable time.
The Solution
Copy as Context adds a simple right-click command to your file explorer to automate this entire process.

(Strongly recommend replacing this link with a real GIF of the extension working!)
✨ Features
- Quick Context Menu Access: Simply right-click any folder in the VS Code Explorer and select "Copy as Context".
- Intelligent Directory Tree: Automatically generates a clean, recursive tree structure of the selected folder.
- Full File Contents: Appends the complete content of every file, clearly labeled with its path.
- Configurable Ignore List: Comes with a robust, pre-configured list to ignore common clutter like
node_modules
, .git
, binary files, and images. You can easily customize this list in your settings.
- Clean UI Integration: The command appears in its own dedicated group in the context menu, keeping your workspace tidy.
🚀 Usage
- In the VS Code Explorer, find the folder you want to copy.
- Right-click on the folder.
- Select "Copy as Context" from the menu.
- A progress notification will appear for larger folders.
- Once complete, paste the formatted context into your favorite LLM chat window!
Example Output
Pasting after using the command will produce a clean, comprehensive block of text like this:
src/
├── components/
│ └── Button.jsx
└── App.js
--- FILE: src/components/Button.jsx ---
import React from 'react';
const Button = ({ children }) => {
return <button>{children}</button>;
};
export default Button;
--- FILE: src/App.js ---
import React from 'react';
import Button from './components/Button';
function App() {
return (
<div>
<h1>Hello, World!</h1>
<Button>Click Me</Button>
</div>
);
}
export default App;
⚙️ Configuration
You can customize which files and folders are ignored.
- Open your VS Code Settings (
Ctrl/Cmd + ,
).
- Search for "Copy as Context".
- Or, directly edit your
settings.json
file to add or remove glob patterns.
Example settings.json
:
{
"copyAsContext.ignore": [
// Default patterns are included here...
"**/node_modules/**",
"**/.git/**",
"**/*.log",
"**/*.zip",
// Add your own custom pattern
"**/__tests__/**"
]
}
💬 Feedback & Contributing
Found a bug or have a feature request? Please open an issue on our GitHub repository. Contributions are always welcome!
License
This extension is licensed under the MIT License.