Automatic comments with Copilot for the Visual Studio Editor
Copilot automatically creates comments for code sections in the Visual Studio Editor. This works with projects in C++ and C#.
(Image: erstellt mit Dall-E von ix)
- Manuel Masiero
The AI assistant GitHub Copilot can now create comments on functions and expressions in Visual Studio. This should make the documentation process easier for programmers.
Copilot gets to work by entering the desired comment format in the editor at the relevant code location, for example, ///. Based on the function content, the AI then automatically creates the function description and summarizes all parameters and available return types. The suggested comment can then be accepted like a code completion using the Tab key.
Videos by heise
The Copilot integration is available for Visual Studio 17.14 Preview 2 and supports project files written in C# and C++. A GitHub Copilot subscription is required for access, although the AI feature is already included in the free plan.
(Image: Microsoft)
C# and C++: How to activate comments
To use Copilot's services, the automatic generation of comments must be activated in the Visual Studio Editor. For projects in C++, programmers can configure the documentation style via Tools, Options as shown in the image below. In addition to XML comments, Doxygen comments are also supported.
(Image: Microsoft)
For C# projects, the following check mark must be set under Tools, Options under Advanced:
(Image: Microsoft)
Further information can be found in the VS blog.
(mho)