C# XML Comments in Visual Studio Code

Visual Studio Code appeared years ago as a light option to the full Visual Studio Environment. Being light, there are some features that we don’t have or at least took some time to appear. C# XML Comments is one of them.

If a code needs to be full of comments, it’s possible the code is not good enough to be read. However, this doesn’t mean we should totally avoid comments. Some explanations on business logic may be useful. If we manage to include these explanations in a standard format that could even be extracted later, even better.

In the past there was an extension for C# XML Comments but since version 1.23.8 the C# XML comments are naively support on Visual Studio Code, but not enabled by default.

In order to enable them, we need to enable the configuration Format On Type on File->Preferences->Settings->Text Editor->Formatting

Basically, we are telling the editor to format our code, in this case the XML Comments, immediately after typing.



I confess I don’t know for sure what other formatting features are included when we enable this option but I would love to discover this. If you find this out, drop a comment on this blog.