VS2005 c# multi-line comments

  • Thread starter Thread starter Paul Cheetham
  • Start date Start date
P

Paul Cheetham

Hi,

If I start a multi-line comment in a c# file with /* then when I press
enter, I get an asterisk indented on the next line.
I want to prevent this from happening, as it's getting really annoying.
I've been through all the settings but I couldn't see one that might
change this behaviour - although I would have thought it should be there
somewhere!

Can anybody tell me how to change this behavoiur?

Thankyou.


Paul
 
Paul said:
Hi,

If I start a multi-line comment in a c# file with /* then when I press
enter, I get an asterisk indented on the next line.
I want to prevent this from happening, as it's getting really annoying.
I've been through all the settings but I couldn't see one that might
change this behaviour - although I would have thought it should be there
somewhere!

Can anybody tell me how to change this behavoiur?

Thankyou.


Paul

Tool > Options > Formatting > Smart comment editing
 
David,
Tool > Options > Formatting > Smart comment editing

This option is not available in Visual Studio 2005 which the original poster
is using. In VS2005, one needs to use this option instead:

Tools > Options > Text Editor > C# > Advanced > Generate XML documentation
comments for ///.

Although the name of the option only speaks about the /// comments (three
slashes), this option also affects the auto-creation of a star character
when one types in /* (slash star) and presses Enter. With this option off,
the star won't be generated automatically on the new line.

However, one doesn't need to disable this option altogether, as it can be
useful sometimes. Instead, one can type in /* and then press
Ctrl+Shift+Enter to move to the next line. The star won't be automatically
added. The Ctrl+Shift+Enter key corresponds to the Edit.LineOpenBelow action
and can be customized using Tools > Options > Environment > Keyboard.

A list of the Visual Studio 2005 keyboard shortcuts is available for example
here:

http://www.codinghorror.com/blog/files/Visual Studio .NET 2005 Keyboard Shortcuts.htm

Another useful way to comment a block of code (as I assume the original
poster is doing) is to select a block of code, and then press Ctrl+K,C to
comment it. To uncomment, one has to press Ctrl+K,U.

Hope this helps.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
(e-mail address removed)
http://www.saunalahti.fi/janij/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top