Any way to automatically wrap comments at column 80 in Visual Studio 2008? ..or display where column 80 is?

StackOverflow https://stackoverflow.com/questions/138703

Question

Is there any way to automatically wrap comments at the 80-column boundary as you type them? ..or failing that, any way to display a faint line at the coulmn 80 boundary to make wrapping them manually a little easier?

Several other IDEs I use have one or other of those functions and it makes writing comments that wrap in sensible places much easier/quicker.

[Edit] If (like me) you're using Visual C++ Express, you need to change the VisualStudio part of the key into VCExpress - had me confused for a while there!

Was it helpful?

Solution

Take a look at the question here: Hidden Features of Visual Studio (2005-2010)?

It shows how to do that:

"Under "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor" Create a String called "Guides" with the value "RGB(255,0,0) 79" to have a red line at column 80 in the text editor."

OTHER TIPS

This is provided as a sample macro:

Macros.Samples.VSEditor.FillCommentParagraph

The first time you run it it'll ask you what fill width you want (i.e. 80). I bind this to Alt-Q since I'm an Emacs refugee. After that you just move into the comment you want to format, run the command, and it'll wrap your comments suitably.

It ain't perfect, but it's pretty good.

For Visual C 2008 Express users (like me) you'll need:

HKEY_CURRENT_USER\Software\Microsoft\VCExpress\9.0\Text Editor

Add a string value called Guides with the following value (as per the other responses):

RGB(180,180,255) 80

In order to make Visual Studio text editor show a faint line on the 80th column you open RegEdit and locate the following:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Text Editor

Please notice that 9.0 is for Visual Studio 2008. You should put 8.0 if you have Visual Studio 2005.

You create a new String value named Guides and enter the following value:

RGB(128,0,0) 80

You can adjust the RGB color to the value you like. The number 80 is the column you want the line to appear at. You can add another line (although I don't see how this can help) like that:

RGB(128,0,0) 2,80

This will make two lines appear, one at the 2th column and one at the 80th column.

HKCU\Software\Microsoft\VisualStudio\9.0\Text Editor\Guides = [REG_SZ] "RGB(192,192,192) 80" (Looking at my 8.0 registry, so I'm not 100% certain)

By the way, in addition to the rightmost guide as per comments above, I also set lower contrast guides for columns 4, 8, 12, 16 etc. This really helps with code readability.

SlickEdit Tools for Visual Studio. There is a very good real time comment wrapper that automatically adjust length of lines as you type.

http://www.slickedit.com/products/slickedit-tools

Take a look at http://www.kynosarges.de/CommentReflower.html.

Comment Reflower for Visual Studio

Comment Reflower is an essential add-in for Microsoft Visual Studio that provides configurable automatic reformatting of block comments, including XML comments.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top