Using GitHub Copilot

GitHub Copilot is a ChatGPT based AI pair programmer extension for Visual Studio Code, Visual Studio, JetBrains IDE, and Neovim. It is most effective in Python, JavaScript, TypeScript, Ruby, Go, C# and C++.

Installation

GitHub Copilot has personal and business subscription model. Start your free trial at https://github.com/features/copilot

Ask for suggestions

  • Create a file with the standard file extension of the language to indicate the preferred programming language to the AI.
  • Start to create a function with the name that describes its purpose (in this example we will use the JavaScript syntax)
    function getDaysInMonth(month, year) {
    (If your IDE automatically adds the closing curly brace, remove it, otherwise Copilot does not offer solutions)
    or
  • Create a comment to describe the functionality
    // Express server on port 3000 and return the current date

Select the suggestion

  • Use the Alt-[ and Alt-] on Windows, Option-[ and Otion-] on Mac to cycle through the suggested solutions and press Tab to accept it, or Esc to reject all of them.

See all suggestions in a new tab

  • Press Ctrl-Enter to open a new tab, and a few seconds later all suggestions will be listed in the new tab.
  • Click the Accept Solution link above the suggestion to insert it into your file.

For more information see the documentation

To activate and deactivate the GitHub Copilot

  • In the lower right corner of the editor click the Copilot icon
  • Select the scope to disable GitHub Copilot: for all languages, or for a specific language only.

Leave a comment

Your email address will not be published. Required fields are marked *