Introduction

CodIn is a powerful VS Code extension that brings AI-powered code explanations directly to your editor. Get instant, clear explanations of any code snippet in over 15 languages including English, Spanish, French, German, Hindi, Chinese, Japanese, and more. Whether you're learning a new programming language, working with complex algorithms, or onboarding to a new codebase, CodIn helps you understand code faster and boost your productivity.

Key Features:

  • 🤖 AI-powered code explanations using OpenAI GPT-3.5-turbo
  • 🌍 Multi-language support (15+ explanation languages)
  • 🔒 Secure API key management with VS Code Secret Storage
  • ⚡ Multiple access methods: CodeLens, context menu, and keyboard shortcuts
  • 🎯 Real-time UI updates and progress indicators

Installation

You can install CodIn directly from the Visual Studio Code Marketplace.

  1. Open Visual Studio Code.
  2. Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or by pressing Ctrl+Shift+X.
  3. Search for "CodIn".
  4. Click the "Install" button.

Usage

CodIn offers multiple ways to get code explanations:

Method 1: Context Menu (Right-click)

  1. Select any code snippet in your editor
  2. Right-click on the selection
  3. Choose "Explain Code" from the context menu
  4. View the explanation in a new panel

Method 2: CodeLens (Inline)

  1. Open any code file - CodeLens appears automatically
  2. Click "Explain" above functions, classes, or code blocks
  3. Get instant explanations without selecting text

Method 3: Command Palette

  1. Press Ctrl+Shift+P (or Cmd+Shift+P on Mac)
  2. Type "CodIn" to see all available commands
  3. Choose from explain, translate, or configuration options

Method 4: Keyboard Shortcuts

  • Ctrl+Alt+E - Explain selected code
  • Ctrl+Alt+L - Select explanation language
  • Ctrl+Alt+A - Set OpenAI API key

Supported Languages

Programming Languages

CodIn works with all programming languages supported by VS Code, including:

  • JavaScript & TypeScript
  • Python
  • Java & C#
  • C & C++
  • Go & Rust
  • Ruby & PHP
  • Swift & Kotlin
  • HTML & CSS
  • SQL & Bash
  • And many more...

Explanation Languages

Get explanations in your preferred language:

  • 🇺🇸 English
  • 🇪🇸 Spanish (Español)
  • 🇫🇷 French (Français)
  • 🇩🇪 German (Deutsch)
  • 🇮🇳 Hindi (हिन्दी)
  • 🇧🇩 Bengali (বাংলা)
  • 🇸🇦 Arabic (العربية)
  • 🇨🇳 Chinese (中文)
  • 🇯🇵 Japanese (日本語)
  • 🇰🇷 Korean (한국어)
  • 🇵🇹 Portuguese (Português)
  • 🇷🇺 Russian (Русский)
  • 🇮🇹 Italian (Italiano)
  • 🇳🇱 Dutch (Nederlands)
  • 🇲🇾 Malay (Bahasa Melayu)

Change your explanation language anytime using Ctrl+Alt+L or the Command Palette.

Configuration

Setting Up Your OpenAI API Key

CodIn uses OpenAI's GPT-3.5-turbo model and requires an API key. Your key is stored securely using VS Code's Secret Storage (encrypted and never logged).

Easy Setup Methods:

  1. Command Palette: Press Ctrl+Shift+P, type "CodIn: Set OpenAI API Key"
  2. Keyboard Shortcut: Press Ctrl+Alt+A
  3. First Use: CodIn will automatically prompt you when you first try to explain code

Getting an OpenAI API Key:

  1. Visit OpenAI API Keys
  2. Sign in or create an account
  3. Click "Create new secret key"
  4. Copy your key and paste it into CodIn when prompted

Language Preferences

Set your preferred explanation language:

  • Use Ctrl+Alt+L to change language quickly
  • Or use Command Palette: "CodIn: Select Explanation Language"
  • Your preference is saved automatically for future use

Security & Privacy

  • 🔒 API keys are encrypted using VS Code Secret Storage
  • 🚫 No code or explanations are logged locally
  • 🌐 Only selected code is sent to OpenAI for explanation
  • 🔐 All communications use HTTPS encryption

Advanced Features

🎯 Smart CodeLens

CodIn automatically detects important code structures and shows "Explain" links:

  • Function and method definitions
  • Class declarations
  • Complex algorithms and loops
  • Import/export statements

🔄 Real-time Updates

The extension provides live feedback:

  • Progress indicators during explanation generation
  • Dynamic CodeLens refresh when code changes
  • Instant language switching without restart

⚡ Performance Optimizations

  • Efficient API usage with optimized prompts
  • Smart caching to reduce redundant requests
  • Background processing for better responsiveness
  • Minimal VS Code performance impact

🛠️ Available Commands

Command Shortcut Description
Explain Code Ctrl+Alt+E Explain selected code snippet
Select Language Ctrl+Alt+L Change explanation language
Set API Key Ctrl+Alt+A Configure OpenAI API key
Toggle CodeLens - Enable/disable inline explanations
Clear API Key - Remove stored API key

🔒 Security Features

  • Encrypted Storage: API keys stored using VS Code Secret Storage
  • No Logging: Code and explanations never saved locally
  • Minimal Permissions: Only necessary VS Code API access
  • HTTPS Only: All communications encrypted in transit

🎨 Integration with VS Code

  • Respects VS Code color themes and fonts
  • Works with all VS Code language extensions
  • Compatible with other productivity extensions
  • Follows VS Code accessibility guidelines

Troubleshooting

Common Issues & Solutions

❌ "Please set your OpenAI API key first"

  • Use Ctrl+Alt+A to set your API key
  • Make sure you copied the complete key from OpenAI
  • Verify your OpenAI account has API credits available

❌ CodeLens not appearing

  • Check that CodeLens is enabled in VS Code settings
  • Try reloading the window: Ctrl+Shift+P → "Developer: Reload Window"
  • Ensure you're in a supported file type

❌ "Explain Code" option missing from context menu

  • Make sure you have text selected before right-clicking
  • Check that the extension is enabled in Extensions view
  • Try using CodeLens or Command Palette instead

❌ Network or API errors

  • Check your internet connection
  • Verify OpenAI API status at status.openai.com
  • Check if your API key has sufficient credits
  • Try again in a few minutes (rate limiting)

❌ Performance issues

  • Large code selections may take longer to process
  • Try explaining smaller code snippets
  • Check VS Code's output panel for any error messages

Debug Information

When reporting issues, please include:

  • CodIn version: 1.2.3
  • VS Code version
  • Operating system
  • Programming language being explained
  • Error messages from VS Code Output panel