Skip to content

Fralleee/copy-context

Repository files navigation

Copy Context

Visual Studio Marketplace Installs Visual Studio Marketplace Version Visual Studio Marketplace Last Updated

Copy files or folder trees into your clipboard as Markdown. Ready to paste into AI, chats, docs, or code reviews.


🚀 Usage

  1. Explorer

    • Select one or more files or folders → right-click → Copy Content
    • Select one or more files or folders → right-click → Copy Tree
  2. Editor Tab

    • Right-click a tab title → Copy Content (This Tab) or … (All Open Tabs).
  3. 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

image

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

image

🔧 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](./LICENSE).

About

VSCode extension that lets you copy context/structure for sharing in Markdown format

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •