A Visual Studio Code extension that streamlines the process of selecting and extracting code files and directories for use in Large Language Model (LLM) chat interfaces. Context Clipboard integrates seamlessly with VS Code's explorer view, providing an intuitive way to manage and format code context for LLM interactions.
Features
📁 Visual File Selection: Easily select multiple files and directories directly from VS Code's explorer view
🎯 Smart Context Management: Exclude irrelevant files and directories to maintain focused context
📊 Token Tracking: Monitor token consumption with real-time feedback using js-tiktoken
⚡ Performance Optimized: Efficiently handles large codebases with asynchronous processing
🔄 Universal Compatibility: Supports all file types that VS Code can open
🎨 Native Integration: Follows VS Code's UI patterns for a seamless experience
🛠️ Configurable Output: Customize context format with file trees and custom prompts
🔄 Git Diff Integration: Include Git diffs with your selected comparison branch
🔘 Quick Toggle Controls: Easily enable/disable features directly from the toolbar
Installation
Open VS Code
Press Ctrl+P / Cmd+P to open the Quick Open dialog
Type ext install context-clipboard
Press Enter
Usage
Open your project in VS Code
In the explorer view, use the checkbox icons to select files and directories
Monitor token usage in real-time as you select files
Use the toolbar toggle buttons to enable/disable Git diff, file tree, or user prompt inclusion
If using Git diff, select your comparison branch using the branch selector button
Click the "Copy Context" button in the explorer view toolbar
Paste the formatted content into your preferred LLM chat interface
Extension Settings
This extension contributes the following settings:
contextClipboard.maxTokens: Maximum number of tokens to include in copied context
contextClipboard.excludePatterns: Glob patterns for files to exclude from selection
contextClipboard.formatTemplate: Custom template for context output formatting
contextClipboard.tokenModel: Token counting model to use (default: 'gpt-4o')
contextClipboard.includeFileTree: Toggle inclusion of file tree structure in output
contextClipboard.includeUserPrompt: Enable custom prompts in context output
contextClipboard.userPromptText: Define custom prompt text for context
contextClipboard.includeGitDiff: Toggle inclusion of Git diff in output
contextClipboard.gitComparisonBranch: Specify which Git branch to compare with (default: 'main')
Accessing Settings
You can configure Context Clipboard settings in several ways:
Command Palette:
Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac)
Type "Settings" and select "Preferences: Open Settings (UI)"
Search for "Context Clipboard"
Settings UI:
Click the gear icon (⚙️) in the lower left corner
Select "Settings"
Search for "Context Clipboard"
Settings File (settings.json):
Open Command Palette
Type "Settings" and select "Preferences: Open User Settings (JSON)"