GitHub Copilot is AI Pair programmer, code synthesizer tool that uses machine learning to provide code suggestions and complete tasks for you while you code. It helps developers write code faster and with greater accuracy, making it easier to explore new code and technologies.
Copilot is FREE to use, you simply need to enable the service see Setting up your GitHub Student and GitHub Copilot as an authenticated Github Student Developer. For detailed instructions on setting up and managing your GitHub subscription, follow the steps in the GitHub official documentation but the following is a short tutorial on how to get started on your copilot journey.
There are a few ways to install extensions in Visual Studio Code, but the quickest one is probably by bringing up the Quick Open panel using Ctrl+P or Cmd+P and then typing the following command:ext install GitHub.copilot
When you confirm it by pressing Enter, it’ll install the extension and prompt you to reload the editor afterward.
Alternatively, you can find the Extensions icon in the Activity Bar located on the left-hand side of the window and try searching for the GitHub Copilot extension from the Visual Studio Marketplace:
Alternatively, you can find the Extensions icon in the Activity Bar located on the left-hand side of the window and try searching for the Microsoft Python Extension from the Visual Studio Marketplace:
Python - Visual Studio Marketplace
After the installation is complete, Visual Studio Code will ask you to sign in to GitHub to give it access to your GitHub profile, which your new extension requires:
Visual Studio Code needs to know who you are to verify your GitHub Copilot subscription status. However, granting access to your GitHub profile will also allow the editor to read your private repositories. If you change your mind, then you can revoke this authorization at any time by going to your GitHub profile settings and finding GitHub for VS Code in the Authorized OAuth Apps. If you are encountering issues see the official Getting started with GitHub Copilot in Visual Studio Code guide.
To make you more productive, here are the most common keyboard shortcuts worth remembering:
Action | Windows / Linux | macOS |
---|---|---|
Trigger inline suggestions | Alt+\ | Option+\ |
See the next suggestion | Alt+] | Option+] |
See the previous suggestion | Alt+[ | Option+[ |
Accept a suggestion | Tab | Tab |
Dismiss an inline suggestion | Esc | Esc |
Show all suggestions in a new tab | Ctrl+Enter | Ctrl+Enter |
Validating GitHub Copilot is working in Visual Studio Code. Check the bottom left and ensure the Copilot logo is visable
To check if GitHub Copilot is working as expected in your Visual Studio Code editor, create a new text file, select Python as the underlying programming language, and start writing a sample such as def hello()
: Open a new file and start to type def hello()
: as soon you type the colon (:
) at the end of the first line to introduce a new code block, GitHub Copilot fills in the suggested function body for you.
Until you either accept it by hitting Tab or reject it with Esc, it’ll show up in gray font. Once Accepted the code is displayed
This simply task confirms that you have your GitHub account enabled and GitHub Copilot Extension is installed your Copilot is working correctly.
You are now ready to use copilot, we would love to hear your experience of using Copilot.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.