DEV Community

Kishan Zalariya
Kishan Zalariya

Posted on • Edited on

4

Become a Code Expert with CodeGPT VSCode Extension

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

  1. Go to extensions menu on VSCode and search for Code GPT then Install it. Install-CodeGPT

Retrieve OpenAI API Key

  1. 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.
  2. Click on the Create new secret key button. Create-ChatGPT-API-Key
  3. Your API key is generated copy it as shown in the image below:
    API-Key-Generated

    **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: Configure-API-Key

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 Commands-CodeGPT
  • See the result of ChatGPT's answer in a new editor window.
  • You can see more features here.

Thanks for reading!!!☺

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more