GitHub has introduced improvements to its Copilot AI coding service, though it remains in invite-only technical preview. Copilot Labs, currently only available as Visual Studio Code extension separate from (but dependent on) the main Copilot extension, adds two new features.
The first is called “explain this code” and aims to provide a plain language description of what a chunk of code does, with potential for speeding the process of understanding an unfamiliar codebase. This is a common problem faced by newcomers to a project, or by developers who need to get up to speed quickly with legacy code that requires maintenance.
The second feature, “translate this code”, is for porting code to a different programming language. A dropdown in the extension panel offers an impressive list of around 60 languages, from ABAP (Advanced Business Application Programming, a SAP language) to yaml, and including most languages in common use, though Pascal is curiously absent. Copilot is happy to have a go at porting C code to Rust, for example. Porting code is another frequent requirement, as developers convert projects to run in different environments or to take advantage of modern programming techniques.
Early reaction to Copilot Labs is positive. “From my quick tests it works really well,” said one developer, and another added that “the language translation tool is awesome.” That said, developers must be realistic about what AI can do and also understand the risks of generated code that may have subtle bugs. Presented with a Bubble Sort routine in C, Explain – a function of Copilot that aims to describe what code does in plain language – delivered a line by line description such as “the sixth line of code is to declare the variable n as an integer and assign it to 0,” and when asked “Code does following” stated in a few lines that it reads numbers into an array and sorts using bubble sort. A good start, though we found it less useful with business-specific code.
GitHub has yet to announce when Copilot will come out of preview and on what terms. The company has said that “If the technical preview is successful, our plan is to build a commercial version of GitHub Copilot in the future.”