A Visual Studio extension that overlays XML doc comments with a rendered image. It makes the comment much more readable and reduces visual noise created by XML-tags.
It works with single line comments in C#, C++, F# (///
) and VB ('''
). Multiline comments (/** */
) are ignored.
original | prettyfied |
---|---|
Download and run the extension (VSIX) for Visual Studio 2022 or later from the Visual Studio Marketplace or, from within Visual Studio, search for "PrettyDocComments" in the "Extensions and Updates" UI.
When the text cursor (or the text selection start or end) is on a doc comment line, the pretty image is hidden and the original XML text is revealed and ready to be edited the usual way.
You can configure the appearance of the prettyfied comments in menu Tools / Options..., section Pretty Doc Comments
You can collapse the comments so that text following the <summary> tag will be hidden. This is a global setting affecting all the comments.
A greater than sign (>) appears to the lower right of the comment if text was hidden.
You can change this setting in three ways:
-
In the Options dialog described above in the section Sizing, option Collapse Comments to Summary
-
Through the menu item Edit > Toggle Collapse Comments to Summary
-
Through a shortcut key. No default key binding is assigned to this toggle command as we want to avoid any clashes with existing shortcuts. You can assign a shortcut key through the menu Tools / Options... by selecting the option Environment > Keyboard.
Here you can search for commands containing "summ". The name of our command is Edit.ToggleCollapseCommentstoSummary. Assign it your desired shortcut key. On my GB-Ascii keyboard Ctr+Shift+\ works well.
If you also have installed and enabled the Shrink Empty Lines extensions from the Microsoft Productivity Power Tools, it might interfere with this extension as both are changing the line heights. This can be avoided by disabling
Tools -> Options -> Productivity Power Tools -> General -> Compress lines that do not have any alphanumeric characters. You can leave the other option Compress blank lines enabled.