GitHub Copilot

GitHub Nov 16, 2021

It's been out a while, but as I recently got onto the Technical Preview for GitHub Copilot here's a quick post on what's new ๐Ÿ‘‡

What is it?

GitHub describes it as Your AI Pair Programmer.

It's like auto complete on AI steroids!

How does it work then?

Copilot needs access to your editor to see your code, so for me I installed the VS Code extension.

VS Code marketplace

Once this is installed & authorised with your GitHub account it can then get context from your code.

As you are coding it will suggest lines and even entire functions for you, based on the language you are using. The technical preview is best suited for Python, JavaScript, TypeScript, Ruby, Java and Go.

Save my fingers

image of human hand touching AI hand

Copilot will convert your comments to code, autofill repetitive code and even write unit tests.

If you add some lines like below it can detect the pattern and complete the rest, this is great for avoiding large amounts of code block copying etc.

Copilot completing repetitive code

If you import a unit test package Copilot suggest tests that match your code.

Copilot suggesting unit tests

Behind the scenes

Copilot is powered by OpenAI Codex and trained on public Internet text and billions of lines of code (Public GitHub repos).

So in essence any code you push to public GitHub repos could be part of the AI model that Copilot uses
How Copilot works

Put it to the Test

To try it out I created a simple JavaScript file and started writing some comments.

Copilot instantly detected this and created the function stub below:

Copilot in VS Code

If you hit Tab it then completes the code for you.

To see more suggestion press Ctrl & Enter and a new tabs opens where you can select a solution.

Once chosen you can edit as needed and carry on coding.

Copilot in VS Code

Had enough? Fly solo

You can disable Copilot globally or just for specific languages though the VS Code extension.

Go for a Spin

I have only briefly explored Copilot but it's definitely the shape of things to come with AI and software development.

For coders this can really enhance productivity and save your fingers in the long run.

There are some questions up in the air about licensing due to it being based on billions of lines of open source code ๐Ÿค”

Check out the links below if you are interested in finding out more!


GitHub - github/copilot-docs: Documentation for GitHub Copilot
Documentation for GitHub Copilot. Contribute to github/copilot-docs development by creating an account on GitHub.
GitHub Copilot ยท Your AI pair programmer
GitHub Copilot works alongside you directly in your editor, suggesting whole lines or entire functions for you.

Tags

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.