Trying Out GitHub Copilot. It's Really Magic!
took the web by storm a couple days ago. The "AI pair programmer" had some fancy gifs to accompany the announcement. It will help write code faster and will let you write less.
Copilot draws context from your comments and your code to infer what code you'll want to write next. In this way, the more you feed Copilot with your comments and your naming of functions will increase the relevance of your recommended code.
During testing, Copilot got function code right 43% of the time on first try and 57% of the time when given 10 attempts. Inspiring, but also terrifying for us coders 😅.
It looked like absolute magic and after trying it out for a few days, I'm happy to announce; GitHub Copilot really is magic.
GitHub Copilot works by using, the AI tool and feeding it public GitHub repos. OpenAI reads through all the code on those repos and is able to learn and suggest code (even whole functions).
I wish I could say jump into your VS Code and install the. Since GitHub Copilot is in closed preview right now, you'll have to and wait.
For this article, I'll be providing some screenshots of Copilot in action. Here's a quick example of trying to type in a function named
GitHub Copilot is able to recommend an entire function 😍 for picking a random item from an array. GitHub recommends using Copilot with small contained functions like the above and will read your comments, variables, and function names to recommend the best code.
It's like StackOverflow autocomplete right in VS Code.
Let's go through some more Copilot suggestions.
This one was interesting. It even knew what API call to use from Twitter. Too bad it used
You can cycle through the code completions using the keyboard shortcut
There is also a little command palette to cycle through suggestions that appears on hover.
If you press
enter Copilot will open up a 2nd pane and give a UI for picking the correct suggestion. This is nicer so you don't have to keep shuffling through the suggestions inline.
A lot of the questions that has come up since Copilot was announced is around privacy and copyrights. The Copilot FAQ does a great job at talking about this and saying that the team is open to considerations and in working together to guide how the project moves going forward.
GitHub Copilot is code synthesizer, not a search engine. The majority of code it generates is uniquely generated and only 0.1% of code generated has been seen verbatim before.
You own and have all the rights to the code that Copilot generates for you.
GitHub Copilot is a promising look at what AI can do to help us as coders. I know there's a lot of talk about AI replacing coders. I see AI helping coders get to providing real value to customers faster.
Copilot truly feels like having a pair programmer next to you. It's like you have a friend searching StackOverflow and suggesting code to you. I don't think it'll take our jobs any time soon.
We as the coders determine what our goals are and who we want to help. Copilot will do what it does best; help create and code our goals... I hope. I could be wrong and Copilot could take over everything 🤷♂️.
Chris Sev is the co-founder of Better Dev. Coding better every day. Previously he created Scotch.io which was acquired.