coby
A VS Code extension that allows you to easily copy file names and content to your clipboard with just a few clicks. Perfect for sharing code snippets, documenting projects, or quickly transferring file information.
Features
- Single File Mode: Copy a file's name and content to your clipboard
- Directory Mode: Copy a directory's tree structure and all contained files' content
- Workspace Mode: Copy the entire workspace structure and file contents
- Smart Filtering: Automatically excludes binary files, large files, and configurable patterns
- Cross-platform Support: Works on Windows, macOS, and Linux
Installation
From VS Code Marketplace
- Open VS Code
- Go to Extensions (Ctrl+Shift+X or Cmd+Shift+X)
- Search for "coby"
- Click Install
Manual Installation
# Clone the repository
git clone https://github.com/wangqin0/coby.git
# Navigate to the project directory
cd coby
# Install dependencies
yarn install
# Compile the extension
yarn compile
# Package the extension
npx @vscode/vsce package
# Install the VSIX file in VS Code
# Press Ctrl+Shift+P (or Cmd+Shift+P on macOS) and run "Extensions: Install from VSIX..."
Usage
Copy a Single File
- Right-click on a file in the Explorer
- Select "Copy Filename and Content"
- The file's name and content will be copied to your clipboard in Markdown format
Copy a Directory
- Right-click on a directory in the Explorer
- Select "Copy Filename and Content"
- The directory structure and all contained files will be copied to your clipboard
Copy All Workspace Content
- Press Ctrl+Shift+P (or Cmd+Shift+P on macOS)
- Run "Copy All Workspace Content"
- All workspace folders and their content will be copied to your clipboard
Configuration
You can configure additional exclusion patterns in your VS Code settings:
"coby.excludePatterns": [
"*.log",
"private_data",
"some_large_directory"
]
By default, the extension already excludes common patterns like:
- Build directories (
dist
, build
, etc.)
- Dependency directories (
node_modules
, etc.)
- System files (
.DS_Store
, etc.)
- Log files (
*.log
, etc.)
- And many more
The copied content follows this Markdown format:
# For directories:
Directory Tree:
📁 directory_name/
📄 file1.js
📁 subfolder/
📄 file2.js
File Contents:
file1.js
console.log('Hello world');
file2.js
function add(a, b) {
return a + b;
}
# For single files:
file1.js
console.log('Hello world');
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development
# Install dependencies
yarn install
# Compile the extension
yarn compile
# Watch for changes
yarn watch