Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Code Summarizer
Code Summarizer

Code Summarizer

Preview

Rahul Bijoor

|
4 installs
| (0) | Free
Summarizes the code
Download

Code Summarizer

Handy Visual Studio command:

Summarize with Gemini – sends the active file (or selection) to Google’s Gemini model and prints a concise summary to the same Output pane.

Target: Visual Studio 2022 (17.14+) • .NET 8.0 • VisualStudio.Extensibility 17.14.x

Features

LLM summary (5–8 bullets: purpose, key types/functions, data flow, I/O, risks/TODOs).

Rate-limit friendly: exponential backoff and model fallback (gemini-1.5-pro → gemini-1.5-flash) on HTTP 429.

Safe payload cap (200k chars) to avoid oversized requests.

No background processing — runs only when you click the command.

Requirements

Visual Studio 2022 17.14 or later.

.NET SDK 8.0 (project targets net8.0-windows).

Packages:

Microsoft.VisualStudio.Extensibility.Sdk 17.14.40254

Microsoft.VisualStudio.Extensibility.Build 17.14.40254

A Gemini API key (Google AI Studio).

Install Option A: VSIX (recommended)

Build the project in Release.

Install the generated OpenUrlExtension.vsix from bin\Release.

Restart Visual Studio.

Option B: Debug / Experimental

Press F5 in Visual Studio to launch the Experimental/Current Instance.

Setup: Gemini API Key

Set an environment variable named GEMINI_API_KEY, then restart Visual Studio.

Command Prompt

setx GEMINI_API_KEY "your_key_here"

PowerShell

(Optional) Choose a model with GEMINI_MODEL (defaults to gemini-1.5-pro):

setx GEMINI_MODEL "gemini-1.5-flash"

Usage

Open any code file (click inside the editor so it’s active).

Go to Extensions menu:

Summarize with Gemini → summary is written to the same Output pane.

Tip: If you don’t see the output, open View → Output and pick OpenUrlExtension from the dropdown.

How it works

Summarize with Gemini Reads the same buffer (or selection), caps to 200k chars, then POSTs to:

https://generativelanguage.googleapis.com/v1/models/{model}:generateContent?key=$GEMINI_API_KEY

On HTTP 429, it retries with exponential backoff and then falls back to gemini-1.5-flash.

Troubleshooting

Commands not visible

Ensure you’re on VS 17.14+.

Build succeeds (no red squiggles).

The classes are marked [VisualStudioContribution] and included in the project (Build Action = Compile).

If you used resource keys for display names, verify .vsextension/string-resources.json is valid JSON. Literal names are safest.

Clicking does nothing

Open View → Output and pick CodeSummarizer (there’s no ShowAsync in SDK 17.14).

Check Output → VisualStudio Extensibility for load errors.

“GEMINI_API_KEY is not set”

Set the variable, then restart Visual Studio (both main and Experimental instances).

HTTP 429 Too Many Requests

Wait a few seconds and try again; the command already retries with backoff.

Consider setting GEMINI_MODEL=gemini-1.5-flash for higher free-tier limits.

Large files

Input is truncated to 200k chars by default (editable in code).

Privacy & Data

The Summarize command sends the selected text (or entire active file) to Google’s Gemini API only when you invoke the command.

This extension doesn’t store or transmit data elsewhere. Your API calls go directly from your machine to Google’s endpoint using your key.

Review Google’s Gemini terms for how request data is handled on their side.

Building from source dotnet clean dotnet restore dotnet build -c Release

VSIX output: .\bin\Release\OpenUrlExtension.vsix

Roadmap / Ideas

Summarize selection only when a selection exists.

Options page to choose model & max chars.

Keyboard shortcut (e.g., Ctrl+Alt+G).

Context menu entry in the code editor.

License

MIT (or your preferred license).

Credits

Built with the VisualStudio.Extensibility SDK (17.14). Gemini® is a Google service; this project is not affiliated with Google.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft