Skip to content

Sadeedpv/codeExplainer

Repository files navigation

Code Explainer

version installs rating License: MIT github

This is a VS Code extension that explains every bit of code inside your editor. It uses the OpenAI API to generate explanations for code.

Code Explainer

Installation

To install the extension, open VS Code and go to the Extensions tab. Search for Code Explainer and click Install. Alternatively, You can install it from here

WHY YOU SHOULD USE IT?

  • You have trouble understanding an open-source project.
  • Or Maybe you just copied the code from Stack Overflow or some other site, and you don't understand what you've just written.
  • You can also write comments to let AI generate your code
  • You can also tell AI to generate the code you want using the input box.

HOW TO USE!?

Once the extension is installed, you can use the command Code Explainer: Explain to get an explanation for any piece of code. All you have to do is select the piece of code you want the explanation for and hit Ctrl + shift + p and search for explain. Alternatively, you can also open Code-explainer by clicking the icon and paste the code in the input box.

EXAMPLES

code-explainer-example

code-explainer-example

Configuration

But before that, you have to configure your OpenAI API key. Go to your VSCode settings(Ctrl + ,) and search for code-explainer and set your OPENAI API KEY which you can easily obtain from here - openai

IMPORTANT !!!

If you want explanation on hover, you can turn on Show Explanation on Hover (Only compatible with JavaScript) from the settings, but we do not recommend it, since it's in the beta stage.

Here is an example of how the extension can be used:

  1. Open a file with some code in it.
  2. Select the code you want to explain.
  3. Click the Code Explainer: Explain command or Open the primary sidebar by clicking the code-explainer icon and paste the code in the input box.
  4. The extension will generate an explanation for the code and show it in a side panel.

CONTRIBUTING

Feel free to contribute to the Project. Even if it's just raising an issue or fixing a typo, it would matter a lot 💘, you can see the Contributing guidelines here. If you would love to donate, See here

I hope you found this extension useful!