Inflammation lets you dictate code inside VSCode/Cursor. It's context aware and let's you convert speech like
export function foo take in string bar and string car return string
into
export function foo(bar: string, car: string): string {}
You can see a demo video here.
It's named inflammation because it's gotten hard for me to type on some days due to inflammation and I needed something I can dictate to on a line-per-line basis.
Contribute
This extension is simple enough for my needs. Please help improve it by submitting a PR.
Usage
After installing, hit cmd + shift + z to start listening. Release when you're done talking.
And that's it.
You can change the hotkey by going into your keyboard shortcut prefs: Preferences :Open Keyboard Shortcuts. from the command pallete.
Installation
From VSCode Marketplace:
https://marketplace.visualstudio.com/items?itemName=moughxyz.inflammation
From vsix file:
You can find the .vsix files in the vsix dir on GitHub:
Prerequisites
1. Audio Recording Software
The extension requires audio recording software to be installed on your system:
-
macOS: Install SoX
-
Windows: Install SoX
- Download from: http://sox.sourceforge.net/
- Add to your system PATH
-
Linux: Install arecord (usually pre-installed)
sudo apt-get install alsa-utils
2. OpenAI API Key
You'll need an OpenAI API key with access to:
- Whisper API (for transcription)
- GPT-4 or GPT-3.5 (for text processing)
Get your API key from: https://platform.openai.com/api-keys
Installation
From VSCode Marketplace:
https://marketplace.visualstudio.com/items?itemName=moughxyz.inflammation
From Source (Development)
- Clone this repository
- Install dependencies:
- Compile the extension:
- Open in VSCode and press
F5to run the extension in a new window
Building the Extension
To create a .vsix package:
- Install vsce globally:
- Package the extension:
- Install the generated
.vsixfile in VSCode/Cursor
Usage
First Time Setup
- Open any text file in VSCode/Cursor
- Press
Cmd+Alt+Z(the extension will prompt for your OpenAI API key) - Enter your API key (it will be stored securely)
Recording Audio
- Place your cursor where you want to insert text
- Press
Cmd+Alt+Zto start recording (you'll see "Recording..." in the status bar) - Speak your code or text
- Press
Cmd+Alt+Zagain to stop recording and process
The extension will:
- Transcribe your audio using Whisper
- Process the transcription with GPT-4 using your file's context
- Insert the result at your cursor position
Configuration
You can configure the extension in VSCode settings:
inflammation.openaiModel: Choose the GPT model (default:gpt-4-turbo-preview)inflammation.whisperModel: Choose the Whisper model (default:whisper-1)
To change your API key:
- Open Command Palette (
Cmd+Shift+P) - Run "Inflammation: Configure API Key"
Troubleshooting
"Failed to start recording"
- Ensure you have the required audio recording software installed
- Check microphone permissions in your system settings
- Try running the audio recording command manually to test
"No speech detected"
- Check your microphone is working
- Speak louder or closer to the microphone
- Ensure no other application is using the microphone
API Errors
- Verify your API key is valid
- Check your OpenAI account has sufficient credits
- Ensure you have access to the selected models
Running Tests
Contributing
Pull requests are welcome! Please ensure your code follows the existing style and includes appropriate tests.
License
MIT
Support
For issues and feature requests, please use the GitHub issue tracker.