A Visual Studio 2022 plugin that integrates Google Gemini CLI for AI-powered code assistance.
- AI Code Analysis: Ask Gemini to explain, review, or optimize your code
- Interactive Tool Window: Chat interface with Gemini AI
- Quick Actions: One-click code explanation, review, and optimization
- Configurable Settings: Set API key, model, and other parameters
- Context-Aware: Automatically includes selected code in queries
- Visual Studio 2022 (Community, Professional, or Enterprise)
- Google Gemini CLI installed and configured
- Install:
npm install -g @google/generative-ai-cli - Configure:
gemini config set apiKey YOUR_API_KEY
- Install:
-
Build the plugin:
dotnet build
-
Install the generated VSIX file:
- Double-click the
.vsixfile in thebin/Debugorbin/Releasefolder - Or use Visual Studio: Extensions ?? Manage Extensions ?? Install from file
- Double-click the
- Open the Gemini tool window: View ?? Other Windows ?? Gemini AI Assistant
- Configure your settings (API key, model, etc.)
- Type your questions or select code and ask Gemini
- Select code in the editor
- Right-click and choose Ask Gemini from the context menu
- Or use the Tools ?? Ask Gemini menu item
- Explain Code: Get detailed explanations of selected code
- Review Code: Get code review suggestions and improvements
- Optimize Code: Get optimization recommendations
The plugin supports the following configuration options:
- API Key: Your Google Gemini API key
- Model: Gemini model to use (default: gemini-pro)
- Max Tokens: Maximum tokens for responses
- Temperature: Creativity level (0.0 - 1.0)
Configuration is saved automatically and persists between sessions.
-
"Gemini CLI not found"
- Ensure Gemini CLI is installed:
npm install -g @google/generative-ai-cli - Check if
geminicommand is available in PATH
- Ensure Gemini CLI is installed:
-
"API key not configured"
- Set your API key in the tool window configuration
- Or configure globally:
gemini config set apiKey YOUR_API_KEY
-
"Request failed"
- Check your internet connection
- Verify your API key is valid
- Ensure you have sufficient API quota
- Check the Output window (View ?? Output ?? Gemini CLI Plugin) for detailed error messages
- Test your Gemini CLI configuration independently:
gemini generate "Hello world"
- Clone the repository
- Open in Visual Studio 2022
- Build the solution
- The VSIX package will be generated in the output directory
GeminiCliPlugin/
?????? Commands/ # Command implementations
?? ?????? GeminiCommand.cs
?? ?????? ShowGeminiToolWindowCommand.cs
?????? Services/ # Core services
?? ?????? GeminiCliService.cs
?????? ToolWindows/ # UI components
?? ?????? GeminiToolWindow.cs
?? ?????? GeminiToolWindowControl.xaml
?? ?????? GeminiToolWindowControl.xaml.cs
?????? Dialogs/ # Dialog windows
?? ?????? GeminiInputDialog.xaml
?? ?????? GeminiInputDialog.xaml.cs
?????? Resources/ # Icons and resources
?????? GeminiCliPluginPackage.cs # Main package class
This project is licensed under the MIT License.
Contributions are welcome! Please feel free to submit issues and pull requests.