I Built a VS Code Extension to Upload Code Snippets to PasteDB in One Click ๐
How It Works
The extension integrates directly with VS Code's command palette and context menus. You can trigger an upload in two ways:
- Upload current file - sends the entire active editor content to PasteDB
- Upload selected code - sends only the highlighted portion of your code
Once triggered, the extension performs automatic language detection based on the file extension or selected code context. It then sends the content to PasteDB's API and returns an instant shareable link.
Installation
- Open Visual Studio Code
- Go to the Extensions view (
Ctrl+Shift+XorCmd+Shift+X) - Search for "PasteDB"
- Click Install
Alternatively, you can install directly from the VS Code Marketplace.
Features
- Secure API key storage - your API key is stored using VS Code's built-in secret storage
- Customizable upload settings - configure default expiration, syntax highlighting, and visibility
- Recent paste history - view and manage your last 50 pastes from within VS Code
- Automatic language detection - detects programming language from file extension or code context
- Instant shareable links - copies the paste URL to your clipboard immediately after upload
Challenges I Faced
Building the extension presented several technical challenges:
- API key security - storing credentials securely required using VS Code's
SecretStorageAPI rather than plain configuration files - Language detection accuracy - mapping VS Code's language identifiers to PasteDB's supported languages required a comprehensive lookup table
- Error handling - network failures and API rate limits needed graceful handling with user-friendly notifications
- Cross-platform testing - ensuring consistent behavior across Windows, macOS, and Linux required extensive testing
More Info
View on Marketplace: PasteDB VS Code Extension
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)
Comments
No comments yet. Start the discussion.