GitHub Copilot is an AI-powered programming partner. You can use it to get suggestions for entire lines or functions directly in your editor. It draws inspiration from the context of comments and code to instantly suggest code. GitHub Copilot is powered by OpenAI Codex, a pre-trained generative language model created by OpenAI. It’s available as an extension for Visual Studio Code, Visual Studio, Neovim, and JetBrains’ suite of integrated development environments (IDEs).
GitHub found that users accepted an average of 26% of all completions displayed by GitHub Copilot in a recent evaluation. They also found that, on average, over 27% of developers’ code files were generated by GitHub Copilot, and in some languages like Python, this number reaches 40%. However, GitHub Copilot does not write perfect code. It’s designed to generate the best possible code given the context it has access to, but it doesn’t test the code it suggests, so it may not always work or even make sense. GitHub Copilot can only contain a very limited context, so it may not use useful functions defined elsewhere in your project or even in the same file. It may also suggest outdated or obsolete uses of libraries and languages. When converting comments written in a language other than English into code, there may be disparities in performance compared to English. For suggested code, some languages like Python, JavaScript, TypeScript, and Go may perform better than other programming languages.
Like any other code, the code suggested by GitHub Copilot must be carefully tested, reviewed, and validated. As a developer, you are always responsible. GitHub Copilot works best when you break your code down into small functions, use meaningful names for function parameters, and write good docstrings and comments as you go. It also seems to work best when it helps you navigate unfamiliar libraries or frameworks.
