A powerful Visual Studio Code extension that revolutionizes how you copy, organize, and manage code snippets with file context. Perfect for developers who need to share code with proper file references and maintain organized collections of related files.
Tired of copying code without context? This extension solves the common problem of sharing code snippets without losing the crucial file path information. Whether you're collaborating with team members, creating documentation, or organizing your code references, Copy Path with Code enhances your workflow with intelligent clipboard management and file organization.
- π Context-Aware Copying - Copy code with full file path and formatting
- π Visual File Organization - Create custom folders to group related files
- π Smart Clipboard Management - Track and manage multiple copied files
- π Advanced Search - Quickly find files across your organized collections
- β‘ Performance Optimized - Lightweight and fast, even with large codebases
- Open VS Code Extensions (
Ctrl+Shift+X
/Cmd+Shift+X
) - Search for "Copy Path with Code"
- Click Install and reload VS Code when prompted
- Open any file in your editor
- Select text (optional) or keep cursor position for full file content
- Press
Ctrl+Alt+C
(Win/Linux) orCmd+Alt+C
(Mac) - Paste anywhere - get beautifully formatted output with path and code!
Example Output:
src/utils/logger.ts:
export class Logger {
static info(message: string) {
console.log(`INFO: ${message}`);
}
}
Feature | Description | Shortcut |
---|---|---|
Basic Copy | Copy file path with content in markdown format | Ctrl+Alt+C |
Error Context Copy | Include error messages and diagnostic information | Ctrl+Alt+A |
Selection Copy | Copy specific code sections with line numbers | (Auto-detected) |
Multi-file Accumulation | Collect multiple files in clipboard for batch operations | (Automatic) |
// Create organized collections of related files
const folderFeatures = {
visualOrganization: "Tree-view interface with expandable folders",
batchOperations: "Add/remove multiple files with selection interface",
workspaceIsolation: "Separate folders per workspace or global access",
quickAccess: "Right-click context menus for all operations",
};
- Temporary Storage: Workspace-specific clipboard preservation
- Content Detection: Automatic parsing of files from clipboard content
- Integrity Protection: Monitoring against external clipboard changes
- Visual Queue: Dedicated panel for detected clipboard files
- Real-time filtering of files and folders
- Case-sensitive options in settings
- Quick file actions through comprehensive context menus
- Cross-workspace file handling with visual indicators
Action | Windows/Linux | macOS | Context |
---|---|---|---|
Copy Path + Content | Ctrl+Alt+C |
Cmd+Alt+C |
Editor focused |
Copy with Errors | Ctrl+Alt+A |
Cmd+Alt+A |
Editor focused |
Transfer Temp to System | Ctrl+Alt+Q |
Cmd+Alt+Q |
Any |
Clear Temp Storage | Ctrl+Alt+Z |
Cmd+Alt+Z |
Any |
Action | Shortcut | Context |
---|---|---|
Add to Folder | Ctrl+Alt+Shift+A |
File focused |
Remove from Folder | Ctrl+Alt+D |
File focused |
Search Files | Ctrl+Alt+F |
Folder view |
Built with modern TypeScript and VS Code extension APIs, featuring a clean architecture pattern for maintainability and extensibility.
graph TB
UI[VS Code UI Layer] --> Providers[Tree Data Providers]
Providers --> Services[Domain Services]
Services --> Entities[Business Entities]
Entities --> Storage[Persistence Layer]
subgraph "Clean Architecture"
Direction[Domain-Driven Design]
Separation[Separation of Concerns]
Testability[Testable Components]
end
Access via VS Code Settings (Ctrl+,
/ Cmd+,
):
{
"copyPathWithCode.enableClipboardDetection": true,
"copyPathWithCode.enableTempStorage": true,
"copyPathWithCode.tempStorageCleanupDays": 7,
"copyPathWithCode.showFileCount": true,
"copyPathWithCode.searchCaseSensitive": false,
"copyPathWithCode.searchIncludeExtensions": true
}
- Open Code Folders View: Click the folder icon in the activity bar
- Create New Folder: Click the + button in the view title bar
- Add Files: Right-click folder β "Add Files to Folder"
- Organize: Use drag-to-select or shift-click for multiple files
// Example: Multi-file workflow for documentation
const workflow = {
step1: "Copy several related files using Ctrl+Alt+C",
step2: "Save to temporary storage with Ctrl+Alt+Q",
step3: "Switch to different workspace or project",
step4: "Restore clipboard contents when needed",
step5: "Paste all files as formatted markdown",
};
- Use
Ctrl+Alt+F
in folder view to search across all files - Filter by file name, extension, or content type
- Search results show match counts and quick navigation
For large codebases (1000+ files):
- Enable "searchIncludeExtensions" to filter by file type
- Use workspace-specific folders instead of global view
- Clear temporary storage periodically
If automatic detection isn't working:
- Check
copyPathWithCode.enableClipboardDetection
setting - Verify clipboard content format matches expected patterns
- Check extension logs via "Show Extension Logs" command
- Use descriptive folder names for better searchability
- Leverage the multi-select interface for batch operations
- Utilize different workspaces for separate project contexts
The extension intelligently handles files across different VS Code workspaces, providing visual indicators and maintaining relative paths where possible.
The extension respects VS Code theme colors and provides additional color customization points for:
- Different workspace indicators
- Search highlights
- Status bar elements
- Folder hierarchy visual cues
While primarily a UI extension, it integrates deeply with VS Code's:
- File system providers
- Clipboard APIs
- Workspace management
- Editor selection context
Operation | Typical Speed | Large Project Impact |
---|---|---|
File Copy | Instant | Minimal |
Folder Creation | <100ms | Low |
Search Filtering | <50ms | Medium (with caching) |
Clipboard Detection | <200ms | Low |
- π Documentation Wiki
- π Issue Tracker
- π‘ Feature Requests
git clone https://github.com/khanhromvn/copy-path-with-code.git
cd copy-path-with-code
npm install
npm run watch
Press F5
to launch extension development host.
MIT License - See full license text in repository.
Built with β€οΈ by Khanh Nguyen and contributors.
- Enhanced folder management system
- Improved cross-workspace file handling
- Optimized performance for large codebases
- Additional color customization points
- Initial public release
- Core copying functionality
- Basic folder management
- Clipboard detection system
Pro Tip: Use the status bar indicators for quick access to clipboard counts and temporary storage management. The extension becomes more powerful as you build collections of commonly used code snippets!
Happy coding! π