JustExplain – AI Code Explainer
Select a class or function in VS Code and get a structured report in a panel beside your code: what the code does, where its real problems are, and which changes are worth making.
Chat assistants answer "explain this" with a wall of text. JustExplain returns a report you can navigate:
- Summary – what the code is for, in a few sentences.
- How it works – the code walked through part by part. Every part links to its lines in the editor.
- Problems – bugs, security holes, unhandled errors and maintainability traps, sorted by severity.
- Improvements – concrete changes with the replacement code and an Apply button.
- Concepts – the language features and terms you need to follow the code.
Two kinds of explanation
Explain is the report described above. Learn is for reading code you do not yet know how to read. It leaves out problems and suggestions and teaches the code instead:
- Piece by piece – the code taken apart from the outside in, fragment by fragment, with what every keyword, operator and bracket means.
- Written out in simple steps – the same code without nesting, with named variables and a comment per step, to compare with the original.
- Concepts – each language feature the code relies on, such as promises or arrow functions, explained from the ground up with a small example.
- Check yourself – two or three questions about how the code behaves, with the answers folded away.
Run JustExplain: Explain Selection for Learning (Cmd+Alt+Shift+E on macOS), click the Learn link above a function, or switch between Explain and Learn with the tabs at the top of the panel. justexplain.detailLevel sets how much a lesson assumes you know.
Usage
- Select code, or place the cursor inside a function or class.
- Run JustExplain: Explain Selection from the context menu or the command palette, or on macOS with
Cmd+Alt+E. Or skip both steps and click the Explain link above a class, function or method.
- Read the report in the panel. It fills in while the model writes: first the summary, then the walkthrough, problems and improvements. Click a line reference such as
L12–18 to jump to the code. Apply appears once the report is complete.
Apply replaces exactly the lines an improvement refers to, and only while they still read as they did when they were analysed. You can undo it like any other edit.
On Windows and Linux no shortcut is set, because Ctrl+Alt+E is how many keyboard layouts type the euro sign. Assign your own under Keyboard Shortcuts.
Stored reports
Every report is saved in .justexplain/reports/ of your project. Files outside a trusted project folder use the private storage of the extension instead. Explaining the same code again, even after it moved within the file or to another file, shows the saved report at once; Run again in the panel asks the model afresh. Reports are keyed by the code itself, so editing a function retires its report automatically.
Commit the folder and your team gets the reports without calling a model. A report that came with the project is marked as such in the panel, and Apply asks before it changes your code: whoever committed the file wrote it, so review such files like code. Add it to .gitignore if you would rather keep them to yourself, or set justexplain.cache to global or off.
A saved report describes the code it was made for. It does not notice when something that code depends on changes elsewhere.
Preparing a file in the background
With justexplain.prepare.enabled, JustExplain explains the classes and functions of the file you are viewing before you ask, one at a time, and marks finished ones as Explain (ready). A status bar item shows the progress; click it to stop.
Only the Explain reports are prepared, not lessons, and only in a trusted workspace with justexplain.cache switched on. This is off by default because it sends that code to your model provider and uses your quota without a click. justexplain.prepare.maxPerFile limits it to 20 explanations per file.
Which AI model is used
JustExplain needs a language model and can get it from four places. The setting justexplain.provider decides; the default auto tries the first three in this order.
| Provider |
What you need |
Set up |
vscode-lm |
A model your editor already provides, for example through GitHub Copilot |
Nothing. With several models, JustExplain: Select Language Model lets you choose. |
anthropic |
An Anthropic API key |
Run JustExplain: Set API Key. The model is set in justexplain.anthropic.model. |
openai-compatible |
Any OpenAI-compatible endpoint: Ollama, LM Studio, OpenRouter and others |
Set justexplain.openaiCompatible.baseUrl and justexplain.openaiCompatible.model. An API key is optional. |
claude-code |
An installed and signed-in Claude Code |
Set justexplain.provider to claude-code. JustExplain then runs claude once per explanation, without tools and outside your project folder. |
Editors built on VS Code that do not offer their models to extensions, such as Cursor, need one of the last two.
Local models with Ollama
ollama pull qwen2.5-coder
Then set justexplain.provider to openai-compatible and justexplain.openaiCompatible.model to qwen2.5-coder. The default base URL already points to a local Ollama server.
Settings
| Setting |
Default |
Meaning |
justexplain.provider |
auto |
Where the model comes from, see above. |
justexplain.language |
auto |
Language of the explanations, for example Deutsch. auto follows the display language of the editor. |
justexplain.detailLevel |
standard |
beginner, standard or expert. |
justexplain.codeLens |
true |
Show the Explain and Learn links above classes, functions and methods of three lines or more. |
justexplain.cache |
workspace |
Where reports are saved: workspace (in the project), global (private to the extension) or off. |
justexplain.prepare.enabled |
false |
Explain the classes and functions of the open file in the background. |
justexplain.prepare.maxPerFile |
20 |
Largest number of explanations prepared per file. |
justexplain.anthropic.model |
claude-opus-5-5 |
Model for the anthropic provider. |
justexplain.claudeCode.path |
claude |
Program started by the claude-code provider. |
justexplain.claudeCode.model |
– |
Model passed to Claude Code, for example sonnet. Empty uses its default. |
justexplain.openaiCompatible.baseUrl |
http://localhost:11434/v1 |
Endpoint for the openai-compatible provider. |
justexplain.openaiCompatible.model |
– |
Model name for the openai-compatible provider. |
Privacy
JustExplain sends the selected code, its file path within the project and, as background, the surrounding file (for large files, 200 lines either side of the selection) to the model provider you chose, and to nobody else.
Which provider, endpoint and model receive your code, and whether code is prepared in the background, can only be set in your user settings. A project you open cannot change them through its own settings file. It collects no telemetry. API keys are kept in the editor's secret storage, never in settings files.
The report is AI-generated. Read a replacement before you apply it.
Development
npm install
npm run build # bundle to dist/
npm run check # type-check
npm test # unit tests
npm run test:integration # downloads VS Code and runs the extension in it
Press F5 in VS Code to start a second window with the extension loaded.
The code is split so that other IDEs can reuse most of it: src/core/ holds the prompt, the report schema and the parser without any editor dependency, and media/ holds the report view as a plain web page.
License
MIT