GitHub Copilot will explain and translate code, now supports Visual Studio and .NET • DEVCLASS

GitHub has made improvements to its Copilot AI coding service, though it remains in an invite-only technical preview. Copilot Labs, currently only available as a separate (but dependent) Visual Studio Code extension from 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 piece of code does, with the potential to speed up the process of understanding an unfamiliar codebase. This is a common problem faced by newcomers to a project or developers who need to quickly get to grips with legacy code that requires maintenance.

The second feature, “translate this code”, allows the code to be ported to a different programming language. A drop-down list in the extension panel offers an impressive list of about 60 languages, from ABAP (Advanced Business Application Programming, an SAP language) to yaml, including most commonly used languages, although Pascal is curiously absent. Copilot is happy to try porting C code to Rust, for example. Code porting is another frequent requirement, as developers convert projects to run in different environments or to take advantage of modern programming techniques.

Translate open source code from C++ to JavaScript with Copilot

Last week, the company also announced the availability of Copilot for Visual Studio 2022. Copilot was already available for IDEs based on VS Code, Neovim, and JetBrains IntelliJ. Visual Studio is the second most popular IDE after VS Code according to the latest Stack Overflow survey. The new Visual Studio extension also explicitly supports .NET languages, including C#. When Copilot launched in June 2021, Github said “Copilot works with a wide range of frameworks and languages, but this technical preview works especially well for Python, JavaScript, TypeScript, Ruby, and Go.”

Initial reactions to Copilot Labs are positive. “From my quick tests it works great,” said one developer, and another added that “the language translation tool is awesome.” That said, developers need to be realistic about what the 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 which aims to describe what the 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 “The code follows”, stated in a few lines that it reads numbers from an array and sorts them using bubble sort. A good start, although we found it less useful with enterprise-specific code.

GitHub has yet to announce when Copilot will release from preview and on what terms. The company said that “if the technical preview is successful, our plan is to create a commercial version of GitHub Copilot in the future.”

Comments are closed.