Explain Function AI
A VSCode extension that explains functions step by step using artificial intelligence (Groq - free).
Features
1. Explain Function
Click on "💡 Explain Function" that appears above each function to get a detailed explanation of the code.
2. Explain Call
Click on "🔍 Explain functionName()" to see the explanation of a called function in the code. The extension:
- Automatically finds the function definition (even in other files)
- Reads the source code
- Provides a complete explanation
Shortcut: Cmd+Shift+E (Mac) / Ctrl+Shift+E (Windows)
Supported Languages
- Python
- JavaScript
- TypeScript
- Java
- PHP
- Go
- Rust
- C/C++
Installation
- Download the
.vsix file from the release page
- In VSCode:
Cmd+Shift+P → "Extensions: Install from VSIX..."
- Select the downloaded
.vsix file
Configuration
1. Get a Groq API Key (Free)
- Go to console.groq.com
- Create a free account
- Generate a new API Key
Cmd+Shift+P → "Explain Function: Set API Key"
- Enter your API Key
Or go to Settings → Extensions → Explain Function AI
3. Change the Explanation Language
By default, the extension automatically detects VSCode's language. To set a different language:
- Open VSCode settings (
Cmd+, on Mac / Ctrl+, on Windows)
- Search for
explainFunction.language
- Select the desired language from the dropdown:
- Auto (detect from VSCode) - Automatically detects VSCode's language
- English
- French
- Italian
- Spanish
- German
- Portuguese
- Chinese
- Japanese
Or manually add to your settings.json:
"explainFunction.language": "English"
Options
| Setting |
Description |
Default |
explainFunction.groqApiKey |
Your Groq API Key |
- |
explainFunction.language |
Explanation language |
Auto (detect from VSCode) |
explainFunction.detailLevel |
Detail level (brief, detailed, very-detailed) |
detailed |
4. Odoo Development Setup
The extension can find function definitions across Odoo source code (Community and Enterprise) using VSCode's python.analysis.extraPaths setting.
To enable Odoo function lookup, add the Odoo source paths to your workspace settings.json (in your Odoo project):
{
"python.analysis.extraPaths": [
"/path/to/odoo/addons",
"/path/to/odoo/odoo",
"/path/to/enterprise"
]
}
Examples by OS:
macOS:
"python.analysis.extraPaths": [
"/Users/yourname/odoo/addons",
"/Users/yourname/odoo/odoo",
"/Users/yourname/enterprise"
]
Linux:
"python.analysis.extraPaths": [
"/home/yourname/odoo/addons",
"/home/yourname/odoo/odoo",
"/home/yourname/enterprise"
]
Windows:
"python.analysis.extraPaths": [
"C:\\Users\\yourname\\odoo\\addons",
"C:\\Users\\yourname\\odoo\\odoo",
"C:\\Users\\yourname\\enterprise"
]
Note: Each developer must configure these paths according to where Odoo is installed on their system. This setting is also used by Pylance for autocompletion, so most Odoo developers already have it configured. When you click "Explain" on a function like is_downpayment(), the extension will search these paths to find the original definition even if you only have your custom module open.
Usage
- Open a file with supported code
- You'll see "💡 Explain Function" above each function
- You'll see "🔍 Explain fetch()" (or other function) on lines with function calls
- Click the button to get the explanation
Build from Source
# Clone the repository
git clone https://github.com/emignox/vscode-explain-function.git
cd vscode-explain-function
# Install dependencies
npm install
# Compile
npm run compile
# Create the VSIX package
npm run package
License
MIT
Author
emignox