Voice Code Snippet Search - VSCode Extension
A powerful VSCode extension that allows developers to search for code snippets using voice commands. Get vetted code snippets with pros/cons analysis instantly.
Features
- 🎤 Voice-Activated Search: Use voice commands to search for code snippets
- 🔍 Intelligent Search: Advanced search with keyword matching and relevance ranking
- 🛡️ Security Analysis: Snippets are annotated with security levels and potential issues
- ⚖️ Pros & Cons: Each snippet includes detailed analysis of advantages and disadvantages
- 📝 Multiple Sources: Aggregates snippets from StackOverflow, GitHub Gists, and curated repositories
- 🚀 Quick Insertion: Insert snippets directly into your code with one click
- 🎯 Language Filtering: Filter results by programming language
- 📊 Popularity Ranking: Snippets ranked by community upvotes and usage
Installation
From VSCode Marketplace (Coming Soon)
- Open VSCode
- Go to Extensions (Ctrl+Shift+X)
- Search for "Voice Code Snippet Search"
- Click Install
Manual Installation
- Clone this repository
- Run
npm install
to install dependencies
- Run
npm run compile
to build the extension
- Press F5 to open a new Extension Development Host window
Backend Setup
The extension requires a backend service for snippet search and indexing.
Navigate to the backend directory:
cd backend
npm install
Copy the environment file and configure:
cp .env.example .env
# Edit .env with your configuration
Start the backend service:
npm run dev
The backend will run on http://localhost:3001
by default.
Usage
Voice Search
- Use the keyboard shortcut
Ctrl+Shift+V
(or Cmd+Shift+V
on Mac)
- Speak your search query (e.g., "JWT authentication Node.js")
- Browse the results in the sidebar
- Click "Insert Code" to add the snippet to your current file
Text Search
- Open the Voice Snippets panel from the Activity Bar
- Type your search query in the search box
- Press Enter or click the search button
- Browse and insert snippets as needed
Commands
Voice Snippets: Start Voice Search
- Begin voice-activated search
Voice Snippets: Open Panel
- Open the snippets panel
Voice Snippets: Insert Snippet
- Insert a selected snippet
Configuration
Configure the extension through VSCode settings:
{
"voiceSnippets.backendUrl": "http://localhost:3001",
"voiceSnippets.language": "en-US",
"voiceSnippets.maxResults": 5,
"voiceSnippets.autoInsert": false
}
Tech Stack
Frontend (VSCode Extension)
- VSCode Extension API: Core extension functionality
- TypeScript: Type-safe development
- Webview API: Rich UI components
Backend Service
- Node.js + Express: RESTful API server
- Redis: Caching and session storage
- Elasticsearch: Advanced search capabilities
- Winston: Structured logging
- Rate Limiting: API protection
Data Sources
- GitHub Gists: Community code snippets
- StackOverflow API: Q&A code examples
- Curated Repository: Vetted, high-quality snippets
Development
Extension Development
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch for changes
npm run watch
# Run tests
npm test
# Package extension
npm run package
Backend Development
cd backend
# Install dependencies
npm install
# Start development server
npm run dev
# Run tests
npm test
# Build for production
npm run build
Architecture
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ VSCode │ │ Backend │ │ Data Sources │
│ Extension │◄──►│ Service │◄──►│ │
│ │ │ │ │ • StackOverflow │
│ • Voice Input │ │ • Search Engine │ │ • GitHub Gists │
│ • UI Components │ │ • Snippet Index │ │ • Curated Repo │
│ • Code Insertion│ │ • Security Scan │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
Roadmap
- [x] Week 1: Project setup & voice pipeline
- [x] Week 2: Query parsing & normalization
- [x] Week 3: Snippet search backend
- [x] Week 4: Ranking & filtering
- [x] Week 5: In-IDE display & snippet insertion
- [ ] Week 6: Voice-driven refinement & follow-up
- [ ] Week 7: Security & style annotations
- [ ] Week 8: Polish & beta launch
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
)
- Commit your changes (
git commit -m 'Add amazing feature'
)
- Push to the branch (
git push origin feature/amazing-feature
)
- Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support