Copy Context

Copy files or folder trees into your clipboard as Markdown. Ready to paste into AI, chats, docs, or code reviews.
🚀 Usage
Explorer
- Select one or more files or folders → right-click → Copy Content
- Select one or more files or folders → right-click → Copy Tree
Editor Tab
- Right-click a tab title → Copy Content (This Tab) or … (All Open Tabs).
Paste anywhere and your Markdown snippet or tree is on the clipboard
✨ Features
Copy Content
- Explorer: grab paths + syntax-highlighted code blocks for selected files/folders
- Tabs: copy the active file or all open files at once (Unsaved buffers (Untitled) are skipped)
- Respects include/exclude globs, VS Code Explorer excludes & (opt-in)
.gitignore
Copy Content
Copy Tree
- Generates a Markdown tree of your selected files/folders
- If you select specific files, only those file paths are included
- If you select folders, the full folder tree and contents are included
- Respects the same filters (globs, Explorer excludes,
.gitignore)
Copy Tree
🔧 Settings
Global Settings
| Setting |
Default |
Description |
copyContext.excludeGlobs |
[] |
Global exclude patterns applied to all commands. Command-specific excludes will be merged with these. |
copyContext.includeGlobs |
[] |
Global include patterns applied to all commands. Command-specific includes will be merged with these. |
copyContext.includeEmojis |
true |
Include emojis in the output (📁 for folders, 📄 for files). |
copyContext.pathOutsideCodeBlock |
false |
Place the file path above the fenced code block (applies to Copy Content and Copy Selection; Copy Tree always keeps the path inside). |
copyContext.maxContentSize |
500000 |
Max total size (bytes) of all file contents to copy. |
copyContext.respectVSCodeExplorerExclude |
true |
Skip files/folders hidden by your VS Code files.exclude settings. |
copyContext.respectGitIgnore |
false |
Skip files matching your project's .gitignore (opt-in). |
Command-Specific Settings
You can override filters for specific commands. These are merged with the global settings.
| Setting |
Default |
Description |
copyContext.copyContent.excludeGlobs |
[] |
Additional exclude patterns for Copy Content only. |
copyContext.copyContent.includeGlobs |
[] |
Additional include patterns for Copy Content only. |
copyContext.copyTree.excludeGlobs |
[] |
Additional exclude patterns for Copy Tree only. |
copyContext.copyTree.includeGlobs |
[] |
Additional include patterns for Copy Tree only. |
Example: Exclude test files globally, but include them when copying content:
{
"copyContext.excludeGlobs": ["**/*.test.ts"],
"copyContext.copyContent.includeGlobs": ["**/*.test.ts"]
}
Path placement
Default placement keeps the path inside the fenced block:
```ts
// src/app.ts
const foo = "bar";
Enable `copyContext.pathOutsideCodeBlock` to move the path above the fence (helps AI prompts avoid echoing the path):
```markdown
src/app.ts
```ts
const foo = "bar";
This applies to Copy Content and Copy Selection (with line numbers). Copy Tree always keeps the path inside the plaintext fence.
---
## 📜 License
This extension is released under the [MIT License](https://github.com/Fralleee/copy-context/blob/HEAD/LICENSE).