Comment reflower for Visual Studio

前端 未结 4 1805
盖世英雄少女心
盖世英雄少女心 2021-02-14 02:28

Is there a built-in command or tool that can reflow C# comments in Visual Studio?

Sometimes, a section of code requires several lines of comments, and after extensive ed

相关标签:
4条回答
  • 2021-02-14 02:54

    If you are using ReSharper, there is the free Agent Smith plugin that can reflow comments.

    0 讨论(0)
  • 2021-02-14 03:00

    Back when I was a Visual C++ Developer I wrote a fairly configurable comment formatting tool called Comment Reflower. I have since changed platforms and so stopped doing ports, but thankfully Christoph Nahr has kept it alive at http://www.kynosarges.de/CommentReflower.html

    0 讨论(0)
  • 2021-02-14 03:03

    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.

    1. Download "Comment Reflower" from http://www.kynosarges.de/CommentReflower.html, unzip into the directory C:\Program Files (x86)\Visual Studio Comment Reflower.

    2. 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.

    3. In VS2012, select Tools..Options..AddIn Security and add the path C:\Program Files (x86)\Visual Studio Comment Reflower.

    4. Restart VS2012.

    5. 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

    1. 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.

    2. 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:

    enter image description here

    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!):

    0 讨论(0)
  • 2021-02-14 03:06

    If you use // or ///-style comments CodeMaid has worked great for me. It is free and open source, and I can use it in both C++ and C#.

    0 讨论(0)
提交回复
热议问题