Code Vault VS Code Extension
🚀 AI-powered code snippet manager that automatically captures and suggests relevant code from your personal library
Overview
Code Vault is an intelligent VS Code extension that helps you build a personal library of code snippets. It automatically captures your code as you work and uses AI to suggest relevant snippets when you need them most.

Features
🤖 Smart Code Capture
- Auto-capture selections: Automatically saves code you select (with cooldown)
- File save capture: Captures entire files when you save them
- Manual capture: Use commands to capture specific code snippets
- Duplicate detection: Prevents saving duplicate or highly similar code
🔍 Intelligent Search & Suggestions
- Relevant snippets: Shows code snippets relevant to your current file
- AI-powered matching: Finds similar code patterns using smart algorithms
- Quick insertion: Insert snippets directly into your code with one click
⚡ Seamless Integration
- Keyboard shortcuts: Ctrl+Shift+V (show snippets) and Ctrl+Shift+C (capture code)
- Context menus: Right-click in editor to access Code Vault features
- Status checking: Verify connection to your Code Vault desktop app
Installation
Prerequisites
- Code Vault Desktop App must be running
- VS Code 1.74.0 or higher
Setup Steps
Install the Extension
# Install from VS Code Marketplace
# Or load from VSIX: Extensions → ... → Install from VSIX
Configure Server URL
- Open VS Code Settings (Ctrl+,)
- Search for "Code Vault"
- Set "Server Url" to your backend:
Start Desktop App
Ensure your Code Vault desktop application is running.
The extension connects to this backend to store and retrieve snippets.
Usage
Basic Commands
| Command |
Shortcut |
Description |
| Code Vault: Show Relevant Snippets |
Ctrl+Shift+V |
View snippets relevant to current file |
| Code Vault: Capture Current Code |
Ctrl+Shift+C |
Manually capture selected code or entire file |
| Code Vault: Check Extension Status |
- |
Verify connection and view stats |
| Code Vault: Refresh Snippet Cache |
- |
Reload snippets from server |
Automatic Capture
- Selection Capture: When you select code and pause for a moment
- File Save Capture: When you save a file (entire file capture)
Manual Capture
- Select code or place cursor in file
- Use Ctrl+Shift+C or command palette
- Enter title and optional description
- Snippet is saved to your personal vault
Finding Relevant Code
- Use Ctrl+Shift+V in any file
- Browse suggestions filtered by language and content
- Click any snippet to insert it at cursor position
Configuration
Extension Settings
{
"codeVault.serverUrl": "https://code-vault-desktop.onrender.com",
"codeVault.autoCapture": true,
"codeVault.captureOnSave": true,
"codeVault.autoSuggest": true
}
Settings Explanation
- serverUrl: URL of your Code Vault backend (local or deployed)
- autoCapture: Enable/disable automatic code capture
- captureOnSave: Capture entire files on save
- autoSuggest: Show automatic snippet suggestions (future feature)
Architecture
How It Works
VS Code Extension → HTTP API → Desktop App → MongoDB
↑
Snippet Cache
- Extension: Captures code and manages UI
- Desktop App: Backend server with REST API
- MongoDB: Cloud database for snippet storage
- AI Analysis: Server-side code similarity detection
Data Flow
- Code captured in VS Code
- Sent to desktop app via POST /api/snippets
- Stored in MongoDB with metadata
- Retrieved via GET /api/snippets for suggestions
- AI analysis via POST /api/ai/analyze for similarity
Troubleshooting
Common Issues
❌ "Cannot connect to desktop app"
- Ensure desktop app is running
- Check server URL in settings
- Verify port 8802 is accessible
❌ Snippets not saving
- Check extension output panel for errors
- Verify MongoDB connection in desktop app
- Check CORS configuration
❌ No suggestions appearing
- Refresh snippet cache with status command
- Check if you have snippets in similar languages
- Verify AI analysis endpoint is working
Debugging
- Check Extension Logs: View → Output → Select "Code Vault"
- Test Connection: Run Code Vault: Check Extension Status
- Manual Testing:
curl https://code-vault-desktop.onrender.com/api/health
Development
Building from Source
# Clone the repository
git clone https://github.com/graciari2000/code-vault-desktop
cd vscode-extension
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Package extension
npm run package
Project Structure
src/
├── extension.ts # Main extension code
├── test/ # Test files
package.json # Extension manifest
tsconfig.json # TypeScript configuration
Key Components
- Snippet Interface: TypeScript interfaces for code snippets
- Capture Logic: Automatic and manual code capture
- Similarity Engine: Code comparison algorithms
- API Client: HTTP communication with backend
API Reference
Snippet Object
interface Snippet {
id: string;
title: string;
code: string;
language: string;
tags: string[];
description?: string;
createdAt: string;
}
Endpoints
GET /api/health - Server status
GET /api/snippets - List all snippets
POST /api/snippets - Create new snippet
POST /api/ai/analyze - AI code analysis
Support
Getting Help
- Documentation: GitHub Wiki
- Issues: GitHub Issues
- Email: graciari2000@gmail.com
System Requirements
- VS Code: ^1.74.0
- Node.js: 16.x or higher
- Code Vault Desktop App: v0.2.0 or higher
Release Notes
v0.2.0
✅ Fixed MongoDB connection issues
✅ Improved error handling and logging
✅ Enhanced duplicate detection
✅ Better CORS configuration
v0.1.0
🎉 Initial release
✅ Basic code capture functionality
✅ Snippet management
✅ VS Code integration
License
MIT License - see LICENSE file for details
Contributing
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Happy Coding! 💻✨
Build your personal code knowledge base with Code Vault - because great developers never write the same code twice.
Code Vault is developed and maintained by Ann Studios