Thanks to visit codestin.com
Credit goes to github.com

Skip to content

WHUT666/genimiclipvs2022

Repository files navigation

Gemini CLI Plugin for Visual Studio 2022

A Visual Studio 2022 plugin that integrates Google Gemini CLI for AI-powered code assistance.

Features

  • 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

Prerequisites

  1. Visual Studio 2022 (Community, Professional, or Enterprise)
  2. Google Gemini CLI installed and configured
    • Install: npm install -g @google/generative-ai-cli
    • Configure: gemini config set apiKey YOUR_API_KEY

Installation

  1. Build the plugin:

    dotnet build
  2. Install the generated VSIX file:

    • Double-click the .vsix file in the bin/Debug or bin/Release folder
    • Or use Visual Studio: Extensions ?? Manage Extensions ?? Install from file

Usage

Tool Window

  1. Open the Gemini tool window: View ?? Other Windows ?? Gemini AI Assistant
  2. Configure your settings (API key, model, etc.)
  3. Type your questions or select code and ask Gemini

Quick Commands

  1. Select code in the editor
  2. Right-click and choose Ask Gemini from the context menu
  3. Or use the Tools ?? Ask Gemini menu item

Quick Actions

  • Explain Code: Get detailed explanations of selected code
  • Review Code: Get code review suggestions and improvements
  • Optimize Code: Get optimization recommendations

Configuration

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.

Troubleshooting

Common Issues

  1. "Gemini CLI not found"

    • Ensure Gemini CLI is installed: npm install -g @google/generative-ai-cli
    • Check if gemini command is available in PATH
  2. "API key not configured"

    • Set your API key in the tool window configuration
    • Or configure globally: gemini config set apiKey YOUR_API_KEY
  3. "Request failed"

    • Check your internet connection
    • Verify your API key is valid
    • Ensure you have sufficient API quota

Getting Help

  • Check the Output window (View ?? Output ?? Gemini CLI Plugin) for detailed error messages
  • Test your Gemini CLI configuration independently: gemini generate "Hello world"

Development

Building from Source

  1. Clone the repository
  2. Open in Visual Studio 2022
  3. Build the solution
  4. The VSIX package will be generated in the output directory

Project Structure

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

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published