How to disable the automatic asterisk in Visual St

2019-01-23 00:49发布

Possible Duplicate:
How do I stop visual studio from automatically inserting asterisk during a block comment?

When adding a multi-line comment in Visual Studio, it automatically places an asterisk (*) at the beginning of a new line (on enter) inside the comment block. I personally find this a nuisance. Does anyone know how to disable it? Thanks.

2条回答
疯言疯语
2楼-- · 2019-01-23 01:21

Found this answer for you online (see here):

This works with Visual Studio 2005 and 2008:

  1. in the IDE, go to Tools->Import and Export Settings; then Export selected environment settings; deselect everything except Options->Text Editor; save to a new file.

  2. Edit your exported settings file in some text editor. Search for the string "AutoComment". There's a PropertyValue tag with value 1, change it to 0, and save the file.

  3. in the IDE, import this new file using Tools->Import and Export Settings. It should stop formatting comments right away.

To be clear, I haven't tested it myself yet . . . please let us know if it works for you.

Update:

Another way, as posted in the previous question on this (linked by Rob van Groenewoud, above)

Tools > Options... > Text Editor > C# > Advanced > Uncheck "Generate XML Documentation comments for ///".

(Of course, in addition to getting rid of the automatic * in block comments, this will disable the autoformatting when you type "///", as it says.)

It sounds like the solution I gave above does the same thing, but by editing the settings file itself instead of using the menu options.

查看更多
老娘就宠你
3楼-- · 2019-01-23 01:27

I would have left this as a comment on John Saunders' answer, but alas, my rep is not high enough :)

Vertical Selections

If you'd rather not be editing settings files, or you want to keep the automatic xml comment generation on typing "///", you could use vertical highlighting to select all the asterices and hit delete. Visual Studio, like Microsoft Office, gives you the ability to select a "column" of text: just hold alt and click-drag your selection across several lines.

Cool!

It's possible you know this already, but it's still worth mentioning.

查看更多
登录 后发表回答