If you want near perfect comment justification with a single keystroke, use Comment Reflower.
Works with VS2012
, VS2013
and VS2015
.
VS2012: To install/upgrade Comment Reflower for Visual Studio 2012
Update 2015-08-31:There is now a Comment Reflower extension available in the extension gallery that easily installs directly from Tools > Extensions and Updates
in VS2012, VS2013 and VS2015.
Download "Comment Reflower" from http://www.kynosarges.de/CommentReflower.html, unzip into the directory C:\Program Files (x86)\Visual Studio Comment Reflower
.
Update file CommentReflower.Addin
so that Version
increments from 10.0
to 11.0
(this upgrades it from VS2010 to VS2012). NOTE: There are two spots in this .xml file where you have to update this version.
In VS2012, select Tools..Options..AddIn Security
and add the path C:\Program Files (x86)\Visual Studio Comment Reflower
.
Restart VS2012.
Now there is new menu items: Tools..Reflow Comment at Cursor
and Tools..Comment Reflower Settings
.
VS2013: To install/upgrade Comment Reflower for Visual Studio 2013
Update 2015-08-31:There is now a Comment Reflower extension available in the extension gallery that easily installs directly from Tools > Extensions and Updates
in VS2012, VS2013 and VS2015.
Repeat instructions above, and change the version in step 2 from 11.0
to 12.0
.
VS2015: To install/upgrade Comment Reflower for Visual Studio 2015
There is now a Comment Reflower extension available in the extension gallery that easily installs directly from Tools > Extensions and Updates
in VS2012, VS2013 and VS2015.
Thanks to @Martin Liversage for pointing this out.
To add a shortcut key that justifies the current comment your cursor is on
Go to Tools..Options..Keyboard
, type reflow
in Show commands containing
, select CommentReflower.Connect.ReflowPoint
, type a key combination (e.g. Ctrl-J
) in the box Press shortcut keys
, then hit Assign
.
Now, if you position your cursor on a comment, and press said key combination (Ctrl-J
), it will automatically (and beautifully) justify the comment for you. You should see the bound key appear in the Tools
menu:
Update margin width
Go into Tools..Comment Reflower Settings
and change the Wrap Width
from the default of 80 to something wider, such as 140
, and the "Minimum Block Width" to 10
(do *not*
set it to anything smaller!):