Speech to Cursor
A powerful VS Code extension that enables voice-to-text functionality and seamlessly integrates with Cursor AI chat. Record your voice, convert it to text, and send it directly to Cursor's AI chat interface with multiple recognition engines and output options.
Features
🎤 Multiple Speech Recognition Engines
- Webview Engine: Uses VS Code's webview panel with Web Speech API for seamless integration
- Browser Fallback: Opens a browser window for speech recognition when webview isn't available
- macOS Dictation: Leverages native macOS dictation (Control key double-press) for optimal performance
- Auto Mode: Intelligently chooses the best available engine based on your system and preferences
- API Engine: Placeholder for future API-based recognition services
📝 Flexible Output Options
- Chat Mode: Send recognized text directly to Cursor AI chat (default)
- Editor Mode: Insert text into the active text editor
- Clipboard Mode: Copy text to clipboard for manual pasting
⚙️ Comprehensive Configuration
- Language Selection: Support for multiple languages (default: en-US)
- Recognition Settings: Toggle interim results and continuous recognition
- Engine Preferences: Fine-tune behavior for each recognition engine
- Browser Integration: Configure auto-start and fallback behavior
Installation
- Clone this repository
- Run
npm install
to install dependencies
- Press
F5
in VS Code to launch the extension in development mode
- Or package the extension using
vsce package
for distribution
Usage
Quick Start
- Open the Command Palette (
Cmd+Shift+P
on macOS, Ctrl+Shift+P
on Windows/Linux)
- Type "Speech to Cursor" to see available commands
- Select "Start Recording" to begin voice recognition
- Speak clearly into your microphone
- The recognized text will be sent to Cursor AI chat automatically
Available Commands
- Start Recording: Begin voice recognition
- Stop Recording: Stop voice recognition
- Toggle Recording: Start/stop recording with a single command
- Open Speech Panel: Open the webview speech recognition panel
- Open Browser Fallback: Open browser-based speech recognition
- Open Control Panel: Access the main control interface
Status Bar Integration
The extension adds a status bar item showing the current recording state:
$(mic) Speech
- Ready to record
$(record) Listening…
- Currently recording
Configuration
Extension Settings
This extension contributes the following settings:
speechToCursor.engine
: Choose the speech engine
auto
(default): Try webview then fallback to browser
webview
: VS Code panel
browser
: Chrome/Edge/Safari
os-dictation
: macOS native dictation
api
: Future API-based recognition
speechToCursor.useBrowserFallback
: Always use browser fallback (default: false)
speechToCursor.useMacDictation
: Use macOS Dictation instead of Web Speech (macOS only, default: true)
speechToCursor.language
: Recognition language tag (e.g., en-US, tr-TR, default: en-US)
speechToCursor.interimResults
: Emit interim results for browser/webview engines (default: false)
speechToCursor.continuous
: Continuous recognition until stopped (default: true)
speechToCursor.browserAutoStart
: Auto-start recognition when browser page opens (default: true)
speechToCursor.outputMode
: Where to send recognized text
chat
(default): Cursor AI chat
editor
: Active text editor
clipboard
: System clipboard
Requirements
- VS Code: Version 1.75.0 or higher
- Microphone: Working microphone with proper permissions
- Browser: For browser fallback mode (Chrome, Edge, or Safari recommended)
- macOS: For native dictation support (macOS only)
Known Issues
- Browser fallback requires user interaction on first use due to browser security policies
- Some browsers may require HTTPS for microphone access in production environments
- macOS dictation requires system-level permissions to be enabled
Troubleshooting
Microphone Not Working
- Check microphone permissions in your browser/system
- Try the browser fallback mode if webview isn't working
- On macOS, ensure dictation is enabled in System Preferences
Text Not Sending to Cursor
- Verify Cursor is running and the chat panel is open
- Check the output mode setting (should be "chat" for Cursor integration)
- Try clipboard mode as a fallback
Recognition Quality Issues
- Ensure you're in a quiet environment
- Speak clearly and at a normal pace
- Try adjusting the language setting to match your speech
- Consider using macOS dictation for better accuracy on Mac
Development
Project Structure
speech-to-cursor/
├── extension.js # Main extension logic
├── package.json # Extension manifest
├── media/
│ ├── recognizer.js # Webview speech recognition
│ └── recognizer.css # Webview styling
└── test/
└── extension.test.js # Test files
Building and Testing
npm install # Install dependencies
npm run lint # Run ESLint
npm test # Run tests
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Release Notes
0.0.1
- Initial release with multiple speech recognition engines
- Webview, browser fallback, and macOS dictation support
- Integration with Cursor AI chat
- Comprehensive configuration options
- Status bar integration
License
This extension is provided as-is for educational and development purposes.
Support
For issues, feature requests, or contributions, please open an issue on the project repository.
Enjoy voice-powered coding with Cursor! 🎤✨