XML Auto Commenting C# in Visual Studio Code

C#Xml CommentsVisual Studio-Code

C# Problem Overview


In MonoDevelop, when I type "///", it auto-generates an xml-style comment like this:

/// <summary>
/// Describes the variable x
/// </summary>
int x = 0;

Is there a way to get this behavior in Visual Studio Code?

C# Solutions


Solution 1 - C#

Starting with C# for Visual Studio Code Extension 1.23.8 this is supported when Editor: Format On Type. setting is enabled.

Settings can be found in the menu under File/Preferences/Settings (Windows/Linux) / Code/Preferences/Settings (macOS). The required setting is available under Text Editor/Formatting.

Solution 2 - C#

This feature is not available out-of-the-box with VS Code, but like most features is available via third-party extensions. As of the time of this answer, here is a popular extension that provides some XML comments support to VS Code:

C# XML Documentation Comments Support for Visual Studio Code

If that extension doesn't work for you, you may be able to find alternatives by searching the VS Code Marketplace

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questions2JakobView Question on Stackoverflow
Solution 1 - C#Pascal BergerView Answer on Stackoverflow
Solution 2 - C#Keisuke KATOView Answer on Stackoverflow