GitHub Robot

Supercharged Coding with GitHub Copilot

A little over a week ago, I was fortunate enough to receive an invite to try out GitHub Copilot. I’ve read articles and watched some YouTube videos about the tech prior to receiving my invite, and was excited to see if it lives up to the hype.

What is Copilot?

Copilot is an AI pair programmer that makes suggestions in your editor as you type. These suggestions include comments, functions, variables, and more.

It is powered by OpenAI Codex, which is trained on publicly available GitHub repositories, as well as natural languages. It works via a Visual Studio Code extension. As you type in the editor, the extension talks with the Copilot web service, which then synthesizes the suggestions.

Copilot makes suggestions as you type. The project shown was created using create-react-app. It provides the user with a search input that will call an API to get a list of fish.

Coding with Copilot

After spending a week with Copilot in the passenger seat, I definitely anticipate it being an essential tool in most developer’s toolboxes.

I am continually impressed with the quality of suggestions that Copilot makes. More often than not, it will suggest near-complete, boilerplate elements.

Copilot suggesting a boilerplate input element.

Copilot’s training data originates from public repositories, so it’s very aware of popular libraries. This gives it the ability to make very time-saving suggestions in projects that use them.

Copilot generates common boilerplate nicely ✅

Copilot isn’t perfect though, and it’s likely that no code-generating AI ever will be. Some suggestions may be completely wrong and break things if you aren’t careful. There’s been a number of times where Copilot suggested unneeded function calls, bad implementations of functions, or got itself caught in a cycle of endlessly providing suggestions, and never closing a function out.

Copilot also carries some risks associated with letting an AI write your code.

Copilot suggestion. Everyone gets a valid token ✨. At least it added a nice TODO reminder.

The Copilot extension isn’t perfect either. There are times where it just seems to stop providing suggestions, and the solution (and not a good one by any means) is to close and reopen the file you were working on. Issues like this are to be expected, given the extension’s maturity.

TLDR

All in all, I think that Copilot will become a valuable asset in every developer’s tool kit. The benefits arising from its ability to suggest boilerplate code are too great to go unnoticed. However, it is much like a double-edged sword. The developer must be aware it suggests a dangerous, deprecated, or just plain bad piece of code.