A VS Code extension that provides AI-powered code explanations using Groq or OpenAI. Select code and view explanations via hover tooltips.
- Explain selected code snippets with AI-generated explanations
- View explanations by hovering over explained code
- Support for Groq and OpenAI providers
- Configurable models and token limits
- File summarization support
Accessing the extension via Command Palette:

- VS Code 1.85.0 or higher
- Node.js 18.x or higher
- API key for Groq or OpenAI
-
Clone this repository:
git clone https://github.com/bhargaviHQ/inline-code-explainer.git cd inline-code-explainer -
Install dependencies:
npm install
-
Build the extension:
npm run compile
- Open the project in VS Code
- Press
F5(works on Windows, Mac, and Linux) to launch a new Extension Development Host window - In the new window, open any code file
- Select code and use the command palette:
- Windows/Linux:
Ctrl+Shift+P - Mac:
Cmd+Shift+PThen run "Explain Selected Code"
- Windows/Linux:
- Hover over the selected code to view the explanation
Configure the extension in VS Code settings:
- Open Settings:
- Windows/Linux:
Ctrl+, - Mac:
Cmd+,
- Windows/Linux:
- Search for "Inline Code Explainer"
- Configure the following:
inlineCodeExplainer.provider: Choose "groq" or "openai"inlineCodeExplainer.apiKey: Your API key (or setGROQ_API_KEY/OPENAI_API_KEYenvironment variable)inlineCodeExplainer.model: Model to useinlineCodeExplainer.maxTokens: Maximum tokens for explanations
Alternatively, add to your settings.json:
{
"inlineCodeExplainer.provider": "groq",
"inlineCodeExplainer.apiKey": "your-api-key-here",
"inlineCodeExplainer.model": "openai/gpt-oss-20b",
"inlineCodeExplainer.maxTokens": 150
}You can provide your API key in two ways:
- VS Code Settings: Set
inlineCodeExplainer.apiKeyin your settings - Environment Variable: Set
GROQ_API_KEYorOPENAI_API_KEYin your environment
- Select code in any file
- Run the command "Explain Selected Code" from the command palette (
Cmd+Shift+P/Ctrl+Shift+P), right-click and select from the context menu, or use the keyboard shortcut:- Mac:
Cmd+Alt+E - Windows/Linux:
Ctrl+Alt+E
- Mac:
- Wait for the explanation to generate
- Hover over the selected code to view the explanation in a tooltip
npm run compilenpm run watchnpm run lintnpm testinlineCodeExplainer.provider: AI provider ("groq" or "openai")inlineCodeExplainer.apiKey: API key for the selected providerinlineCodeExplainer.model: Model identifierinlineCodeExplainer.maxTokens: Maximum tokens for explanations


