Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Explain Code InlineNew to Visual Studio Code? Get it now.
Explain Code Inline

Explain Code Inline

Nithin Mohan

|
2 installs
| (0) | Free
Grey one-line LLM explanations above the code you select or put the cursor on (Claude, or any OpenAI-compatible local server).
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Explain Code Inline

Short grey explanations of your code, shown right in the editor as you work.

  • Cursor line: put the cursor on a line and a one-line explanation appears above it.
  • Selection: select some code and get a short explanation of what it does.
  • Instant on revisits: explanations are cached, and by default the whole open file is explained in the background, so most lines show their explanation without waiting.

Works with Claude through the Anthropic API, or with any OpenAI-compatible server running locally (mlx_lm.server, llama.cpp server, vLLM, SGLang, Ollama).

Getting started

With Claude

  1. Get an API key from the Anthropic Console.
  2. Run Explain Code: Set Anthropic API Key from the Command Palette. The key goes into VS Code's secret storage. You can also set the ANTHROPIC_API_KEY environment variable instead.
  3. Open a code file and move the cursor.

The default model is claude-haiku-5-5 with low effort, which is fast and cheap. You can change both in settings.

With a local model

  1. Start any OpenAI-compatible server, for example mlx_lm.server --model <model> or ollama serve.
  2. Set explainCode.provider to openai-compatible.
  3. Set explainCode.openai.baseUrl (including /v1) and explainCode.openai.model to match your server.

Where explanations appear

explainCode.lineExplain sets where explanations appear:

Value Behavior
above (default) Grey text above the line or selection (CodeLens). The code shifts down a line while it's shown.
endOfLine Ghost text at the end of the line. Appears instantly and doesn't move the code.
off No explanations.

Privacy and cost

Your code is sent to the backend you configure. With explainCode.prefetchFile on (the default), the whole open file is sent in 100-line chunks so explanations are ready before you reach each line, and edited lines are sent again. Each file also gets one short summary request, which is used as context.

To send less, turn off explainCode.prefetchFile. Then only the lines you stop on and the code you select are sent, along with a few surrounding lines (explainCode.contextLines). To keep code on your machine, use a local OpenAI-compatible server.

Prose and log files (Markdown, plain text, logs) are never sent.

Settings

Setting Default Description
explainCode.provider anthropic anthropic or openai-compatible.
explainCode.anthropic.model claude-haiku-5-5 Claude model ID.
explainCode.anthropic.effort low How much Claude thinks before answering: low to max.
explainCode.anthropic.fastMode false Faster output at a higher price, on models that support it.
explainCode.openai.baseUrl http://localhost:8080/v1 OpenAI-compatible server URL, including /v1.
explainCode.openai.model default Model name sent to that server.
explainCode.openai.apiKey Optional bearer token for that server.
explainCode.lineExplain above above, endOfLine or off.
explainCode.lineDelayMs 150 How long the cursor must rest on an unexplained line before a request is made.
explainCode.lineMinChars 6 Skip short lines such as } or else:.
explainCode.selectionDelayMs 250 How long a selection must stay unchanged before it's explained.
explainCode.minChars 8 Ignore shorter selections.
explainCode.contextLines 20 Surrounding lines sent as context.
explainCode.prefetchFile true Explain the whole open file in the background.
explainCode.prefetchFileMaxLines 3000 Don't prefetch longer files.

Commands

  • Explain Code: Set Anthropic API Key
  • Explain Code: Clear Cache: forget all saved explanations. The cache persists across restarts.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft