A comprehensive Visual Studio Code extension designed to enhance your development workflow by integrating multiple state-of-the-art Large Language Models (LLMs) directly into the editor. This extension provides code generation, intelligent suggestions, problem-solving assistance, and even workflow visualization—helping developers save time, boost productivity, and understand code structurally.
Active GROQ API Key (FREE VERSION) supports : Gemini 1.5 Flash , Llama 3.1 (8B, 405B), Gemma 2 (9B). Paid APIs can be used to access more advanced models.
- Introduction
- Key Features
- Demos
- Prerequisites
- Installation and Setup
- Configuration
- Usage
- Technical Overview
- Code Snippets
- Repository
The LLM Copilot Extension for VS Code was developed to enhance coding efficiency by seamlessly integrating advanced AI models like Llama 3.1, OpenAI GPT-3.5-Turbo, and Google Gemini 1.5. These models enable:
- Context-aware code generation
- Autocompletion and bug fixing
- LeetCode/DSA problem-solving
- Workflow diagram generation from functions
- Code Analysis Features:
- -Right-click menu integration
- -Detailed pattern analysis reports
- -Performance metrics report
- -Actionable improvement suggestions
This extension uses a modular provider architecture, making it easy to plug in new providers and scale capabilities as newer LLMs emerge.
Switch between AI providers and their flagship models directly within the chat interface:
| Provider | Supported Models |
|---|---|
| Groq | Llama 3.1 (8B, 405B), Gemma 2 (9B) |
| Gemini 1.5 Pro, Gemini 1.5 Flash | |
| OpenAI | GPT-4o, GPT-3.5-Turbo |
|
Architectural Diagram of step by step input propagation |
- Intuitive Webview panel for querying LLMs.
- Handles everything from small snippets to complex architecture discussions.
- Automatically generate Mermaid.js flowcharts from selected functions.
- Helps document, visualize, and debug complex logic.
- Generate context-aware snippets.
- Solve LeetCode & DSA problems.
- Assist with debugging and unit test generation.
- Built with HTML, CSS, and JS.
- Dropdown for model selection.
- AI responses displayed in formatted code blocks.
To visualize your code flow:
- Select the code you want to visualize
- Right-click and select "AI: Generate Workflow Diagram"
- View the generated Mermaid.js flowchart showing:
- Control flow
- Conditional branches
- Loop structures
- Error handling paths
To analyze patterns in your code:
- Select the code you want to analyze
- Right-click and select "AI: Detect Code Patterns"
- View the comprehensive analysis including:
- Design patterns identified with confidence levels
- Anti-patterns and code smells
- Performance metrics and bottlenecks
- Actionable recommendations
Ensure the following are installed:
- Visual Studio Code (v1.92.0 or higher)
- Node.js (v18.x or higher)
- TypeScript (for compiling)
- API Keys from supported providers: Groq, OpenAI, Google, Together.ai
git clone https://github.com/Panchadip-128/LLM_Copilot_Extension
cd LLM_Copilot_Extensionnpm installnpm run compilecode --extensionDevelopmentPath=PATH_TO_PROJECTOr press F5 inside VS Code.
Add your API keys to settings.json:
{
"codeAssistant.groq.apiKey": "YOUR_GROQ_API_KEY",
"codeAssistant.gemini.apiKey": "YOUR_GEMINI_API_KEY",
"codeAssistant.gpt.apiKey": "YOUR_OPENAI_API_KEY"
}- Launch the extension (F5 in VS Code).
- Open Command Palette (Ctrl+Shift+P) →
Open AI Code Assistant. - Choose a provider, type queries, and interact in the chat panel.
- Right-click on any function →
Generate Workflow Diagram.
Click to expand
-
package.json
- Metadata (name, version, engines)
- Defines commands (e.g.,
extension.openChat) - Includes dependencies like axios for API calls
-
extension.ts
- Registers commands
- Creates and manages Webview panel
- Orchestrates communication between UI ↔ Backend ↔ API Providers
-
API Providers
- Modular classes:
GroqProvider,GeminiProvider,GPTProvider - Encapsulate authentication, request formatting, response parsing
- Modular classes:
-
getCodeSnippet Function
- Sends POST requests with user query
- Processes and formats AI responses
- Returns code snippets or workflow diagrams
-
UI (Webview)
- Built with HTML, CSS, JS
- Dropdown for provider/model selection
- AI response shown in code block with copy support
export function activate(context: vscode.ExtensionContext) {
let disposable = vscode.commands.registerCommand('extension.openChat', () => {
const panel = vscode.window.createWebviewPanel(
'aiAssistant',
'AI Code Assistant',
vscode.ViewColumn.One,
{ enableScripts: true }
);
panel.webview.html = getWebviewContent();
});
context.subscriptions.push(disposable);
}async function getCodeSnippet(query: string, provider: string): Promise<string> {
const response = await axios.post(`https://api.${provider}.com/v1/generate`, {
prompt: query,
max_tokens: 500
}, {
headers: { 'Authorization': `Bearer ${getApiKey(provider)}` }
});
return response.data.output || "No response received.";
}<!DOCTYPE html>
<html>
<head>
<style>
body { font-family: Arial, sans-serif; }
#response { background: #f4f4f4; padding: 10px; border-radius: 5px; }
</style>
</head>
<body>
<h2>AI Code Assistant</h2>
<select id="modelSelector">
<option value="gpt">OpenAI GPT</option>
<option value="gemini">Gemini</option>
<option value="llama">Llama</option>
</select>
<textarea id="query" placeholder="Type your question here..."></textarea>
<button onclick="sendQuery()">Ask</button>
<pre id="response"></pre>
</body>
</html>Access the complete source code here:
👉 LLM Copilot Extension on GitHub
Likewise code analysis id segmented into multiple parameters as follows in sidewise copilot window:
Overall, This extension serves as a powerful companion for
Code Generation , Problem Solving , Simplification and Visualization of Complex Refactored Codes , Performance Analysis , Suggestions for improvements
-
LeetCode & DSA Problems:
- Paste the problem description
- Get optimized solutions with explanations
- Receive time and space complexity analysis
-
Unit Test Generation:
- Select the code to test
- Request test generation
- Get comprehensive test cases with edge cases
-
Debugging Assistance:
- Share error messages or stack traces
- Get step-by-step debugging guidance
- Receive suggested fixes and explanations
-
Multi feature pattern extraction and Visualization:
- Performance Analysis (Time Complexity, Space Complexity and its instances)
- Design Patterns (Location inside Code, Its Impact and likewise suggestions)
- Anti Patterns( To be avoided further for improvements, its solution and severity)
- Recommendations within code and its potential performance analysis




