GitHub Copilot — One Month Later

AI has taken the world by storm with the release of Chat-GPT. There is a lot of investment in AI tools to automate specific tasks. Today I wanted to give a review of GitHub Copilot. If you’re unfamiliar with it, it’s an AI tool that helps you write code. GitHub is selling it as an AI Pair Programmer. It’s meant to help you focus on solving the larger problems by allowing Copilot to solve the smaller details of your codebase. It is supposed to help you work with unfamiliar programming languages and give you inline suggestions as you’re coding. For some context, I typically use VS Code when I’m working so that’s the perspective I’ll be coming from. Copilot does work for other IDEs like Visual Studio or JetBrains IDEs.

The Good

As the title suggests, I’ve used Copilot for around a month. My overall opinion is that this is an excellent tool. I have enjoyed using it, and it has definitely helped me work out some tricky coding problems.

Code Completion

One of the awesome features is automatic code completion. Basically, as you’re typing, it’ll start to suggest the next bits of code.

Once we start typing out a function, it will suggest the next line or a few lines for us. I’ve found, more often than not, the suggestions are actually what I was about to do or something a little better than what I was about to do. This is definitely a feature that helps speed up how much code I can produce.

Understanding Code Context

Once you’ve gotten into a relatively large project, some of the minor bug fixes or new features will be fairly specific. You’ll be using many functions you’ve built previously or maybe some constants you’ve defined somewhere in your code. One of the coolest things is that Copilot will “understand” what you want and suggest it for you. This functionality can be a little iffy at times, but when it works, wow is it cool.

Prompting for a Full Function

One of the cool things it does is suggest functions or blocks of code based on a comment. If you highlight your comment and press control + enter, it will suggest ten solutions, and it will give comments sort of explaining the code.

Here’s an example function generated by Copilot.

This is really cool if you’re looking to do something like a binary search or generate a UUID. Normally, I wouldn’t even bother with creating a function to do something like generate a UUID. If I needed it, I’d typically install a package. Is that the best thing in the world? No, definitely not. However, What I’ve done is use Copilot to create these utility functions for me. 

The Bad

While I generally like this tool, I find some things pretty annoying. I don’t think these are major things, but definitely stuff I’d like to see fixed if possible.

Competing Extensions

So I love the code completion, but it 100% gets in the way of the IntelliSense of the IDE or extension. Once it makes a suggestion I cannot, for the life of me, get the IntelliSense to kick in when what it’s suggesting isn’t what I want. This doesn’t happen too often, but it’s super frustrating when I just want to know what functions are available to me and I can’t get it to pop up.

Incomplete Functions

Along with code completion, we also saw how it will generate whole blocks of code based on a comment prompt. I’ve noticed that if your comment is in 2 lines it won’t give you a correct response.

Rather than generating your code it will just give you a bunch of comments. Your prompt basically has to be a single line (at least for JS/TS) or it won’t be fully accurate. Here’s another example of a non-function being generated.

I wish I could just put “your code here” and call it a day….

This is not a super helpful suggestion at all.

Improper Placement

This was a hard thing to get a screenshot of because it really doesn’t happen that often. However, every so often you’ll notice that you’ll be typing something like this const result = splitName('John Doe'); Before you are able to complete the line it will suggest this const result = splitName('John Doe'';); Which then gives you an error. This was a pretty minor issue, but if you’re working with a lot of brackets it might suggest something like what I described above.

Overall I like it

Overall, I really like this tool. I’m definitely happy to continue to use it and pay for it. I think this is a really solid tool to help write a lot of boilerplate code for you. I like the fact that I can generate utility functions and code blocks that take away mundane tasks so that I can focus on putting things together. So far, there are only a few things that annoy me, but not nearly enough to take away from its usefulness. If you’re curious about it, I would go ahead and give it a try!

Previous
Previous

Taking a Look at ChatGPT

Next
Next

How worried should we be about the AI takeover?