My experience with Github Copilot

An image illustrating github co-pilot


Copilot is the microsoft’s text based AI modelling tool. It is a tool that can be used to generate text based on a given input. It is built on top of openAI’s GPT-2 model. It is a text based model that can be trained on a large corpus of text. It is a great tool for building a text based model.

GPT-2 is trained on all opensource pages on github. Thus the machine learning model of this learned a lot about various programming languages. The best thing about GPT-2 is that it can generate very obvious most used pieces of code by taking simple strings as commands.

For example, if you give it the string “print” it will generate a print statement in the respective programming language. If you ask it to write a function, it will generate a function definition. If you ask it to generate an algortigm, it will generate a complete algorithm.

Screenshot of github copilot

How to use Copilot?

As it is still in technical preview there is no direct way to get copilot. You have to sign up for the technical preview from Github. Github team will get back to you with an email that you are invited to sign up for the preview.

Screenshot of email from copilot team

You need copilot supported text editor to use it. I am using Visual Studio Code from Microsoft. It is officially supported by copilot team. Hence you can use this editor for testing. Note that copilot is still in preview and it is not recommended to use it in production means you cannot blindly use the suggestions from it. You have to verify the results and make sure there are no errors.

Keyboard Shortcuts

You should get familiar with common keyboard shortcuts for GitHub Copilot. They’ll vary slightly, depending on whether you’re using macOS, Windows, or Linux.

Here are the ones you should know:

Accept inline code suggestion — Tab
Dismiss inline code suggestion — Esc
Show next suggestion — Alt + ] or Option (⌥) + ]
Show previous suggestion — Alt + [ or Option (⌥) + [
Trigger suggestion — Alt + \ or Option (⌥) + \
Open ten suggestions in a separate pane — Ctrl + Enter

Keep these close by as a quick reference as you’re working

Final Remarks

There are similar projects like tabnine that can be used to generate code suggestions. But tabnine is not open source and you have to pay to use it, yet there is a free tier with limited functionalities.

Write to me if you like this article.


Twitter: @giriaakula