Jon Cage
Jon Cage

Reputation: 37500

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

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!

Upvotes: 13

Views: 5339

Answers (9)

Roger Dahl
Roger Dahl

Reputation: 15734

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.

Upvotes: 0

Grokys
Grokys

Reputation: 16546

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

Upvotes: 14

user235162
user235162

Reputation:

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

Upvotes: 0

David Stocks
David Stocks

Reputation: 81

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.

Upvotes: 8

Chris Ballard
Chris Ballard

Reputation: 3769

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.

Upvotes: 0

Petros
Petros

Reputation: 8992

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.

Upvotes: 2

Jon Cage
Jon Cage

Reputation: 37500

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

Upvotes: 3

Anheledir
Anheledir

Reputation: 4387

See Blogpost from Sara Ford: http://blogs.msdn.com/saraford/archive/2004/11/15/257953.aspx

Upvotes: 2

MSalters
MSalters

Reputation: 179991

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)

Upvotes: 1

Related Questions