DSA Complexity Analyzer for VS Code

Analyze the time complexity, space complexity, and overall quality of your algorithms and data structures directly within Visual Studio Code, powered by Google's Gemini AI.
This extension provides a seamless way to get instant feedback on your code snippets, helping you write more efficient and optimized solutions.
Features
- Instant Analysis: Get Time Complexity, Space Complexity, and a Quality Score for any selected code block.
- Detailed Explanations: Understand the "why" behind the analysis with detailed explanations provided by the AI.
- Secure: Your Google Gemini API key is stored securely using the VS Code Secret Storage API.
- Themed UI: The analysis panel adapts to your current VS Code theme for a native look and feel.
- Model Selection: Choose the Gemini model that best suits your needs (defaults to
gemini-1.5-flash).
How It Works
When you select a piece of code and run the analyzer, the extension sends the code to the Google Gemini API with a specialized prompt. It asks the model to return a structured JSON object containing the analysis, which is then beautifully formatted and displayed in a webview panel.
(Note: You can replace this with a real screenshot or GIF of your extension)
Requirements
- Visual Studio Code: Version 1.60 or higher.
- Google Gemini API Key: You need an API key to use the underlying AI model.
Installation
- Open Visual Studio Code.
- Go to the Extensions view (
Ctrl+Shift+X or Cmd+Shift+X).
- Search for
DSA Complexity Analyzer.
- Click Install.
Setup
Before you can use the extension, you need to configure it with your Google Gemini API key.
Getting a Gemini API Key
- Go to the Google AI Studio.
- Sign in with your Google account.
- Click on "Get API key" and then "Create API key in new project".
- Copy the generated API key to your clipboard.
Configuring the Extension
- In VS Code, open the Command Palette (
Ctrl+Shift+P or Cmd+Shift+P).
- Run the command:
Analyze DSA Complexity.
- A new panel will open with a settings screen.
- Paste your Gemini API key into the "Gemini API Key" input field.
- (Optional) You can change the model name if you wish.
- Click "Save Settings".
Your key is now securely stored, and you are ready to analyze your code!
Usage
- Open any code file (e.g., JavaScript, Python, Java, C++, etc.).
- Highlight a function or a specific block of code you want to analyze.
- Right-click on the selected text.
- Select
Analyze DSA Complexity from the context menu.
- The analysis results will appear in a new panel to the side.
Commands
Analyze DSA Complexity: Triggers the analysis for the selected code.
Release Notes
1.0.0
- Initial release of the DSA Complexity Analyzer.
- Core functionality for analyzing time/space complexity.
- Secure API key storage and configurable model.
Contributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
License
MIT
Made by Harshit Kowsik