In this article, we will learn how to configure the CodeGPT extension in VSCode and its use cases.
What is CodeGPT?
CodeGPT VSCode Extension is a plugin for the popular code editor, Visual Studio Code (VSCode), that utilizes OpenAI's language model to provide advanced code completion functionality. The extension integrates directly into VSCode, providing real-time code suggestions as you type. Using advanced machine learning algorithms, CodeGPT VSCode Extension can understand the context of your code and provide suggestions that are relevant to your current coding task. This can help you save time and improve your coding efficiency by reducing the time spent searching for the right code snippets. CodeGPT VSCode Extension is designed to make coding faster, more efficient, and more enjoyable for VSCode users.
Features of CodeGPT
- Ask general questions
- Right click on a code selection and run one of the context menu shortcuts
- Automatically write documentation for your code
- Explain the selected code
- Refactor or optimize it
- Find problems with it
- View GPT's responses in a panel next to the editor
Install Extension
- Go to extensions menu on VSCode and search for
Code GPT
then Install it.
Retrieve OpenAI API Key
- Go to OpenAI's website. If you don't have an account, you will need to create one or sign up using your Google or Microsoft account.
- Click on the
Create new secret key
button. -
Your API key is generated copy it as shown in the image below:
**NOTE*: When you create a new account, you receive $18 in free credits for the API which you must use in the first 90 days. You can see API usage information here.
Configure API Key in CodeGPT
Now, the final step is to put this secret key in the settings of VSCode extension Code GPT. By perform the following steps:
- Press
Ctrl+Shift+P
- Search for
CodeGPT: Set API KEY
- Finally, insert the Key and press
Enter
as shown in the image below:
Ready to Use
- Select any code, open the context menu with the right mouse button, and choose the desired option from the list:
-
Ask CodeGPT
: will provide a prompt for you to enter any query Compile & Run CodeGPT
Explain CodeGPT
Refactor CodeGPT
Document CodeGPT
Find Problems CodeGPT
-
Unit Test CodeGPT
-
- See the result of ChatGPT's answer in a new editor window.
- You can see more features here.
Thanks for reading!!!βΊ
Top comments (0)