Do you find it difficult to switch between tabs when seeking code assistance from ChatGPT? Have you ever had 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. In this blog, I will talk about Code Explainer, a VsCode Extension that uses AI to explain or generate code snippets from the editor itself.
Since it's an open-source project, you can contribute here (Give it a star if you like ⭐): GitHub
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
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.
WHY YOU SHOULD USE IT?
- You are tired of switching from VsCode to Google frequently.
- 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.
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.
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 💘
If you would love to donate, See here
Conclusion
I strongly recommend trying out and installing this extension. I trust you found it beneficial, and if you have any suggestions or ways to enhance it, kindly share them in the comments.
Top comments (2)
🙌🏼🙌🏼
🙇♀️🙇♀️🙇♀️🙇♀️