Visual Studio 2010 Red Comments

2019-08-05 07:20发布

Using the default template, I know I've noticed some comments turned to red (from the default green) in Visual Studio 2010. But I can't find them at the moment. I also can't seem to google up a keyword which causes this.

Can anyone tell me what this feature is called or what the word that VS2010 looks for in the comment to enable it?

3条回答
The star\"
2楼-- · 2019-08-05 07:30

It looks for "TODO" or "Note", and possibly others. I thought though that this was a Reshaper feature, not not native to plain VS. Are you using Resharper? I believe what is highlighted are items that show up in your TO-Do task list.

With Resharper: Tools > Options > Environment > Fonts & Colors > Resharper Todo Item. Here, you can adjust the color. I don't see where you can explicitly turn the feature off.

查看更多
ら.Afraid
3楼-- · 2019-08-05 07:42

i think Roadrunner are right. It sounds like a plugin feature.

VsCommands as exemple. download

查看更多
我命由我不由天
4楼-- · 2019-08-05 07:43

Out-of-the-box, Visual Studio itself, though various optional third-party plugins, e.g. Resharper and VSCommands, can cause this.

Resharper

If you need help with comments formatting in Resharper, there is a reply above, and also a dedicated page addressing omments formatting in Resharper here:

TODO comment font color in VS2010 with ReSharper and Productivity Power Tools

VSCommands Pro

I have VSCommands 2010 Lite installed, and it displays my comments in red after the word "Note". That feature is called "Comments Formatting" in VSCommands. VSCommands comes in two editions, "Pro" and "Lite", of which only the former can change the setting without uninstalling it.

Their options for that setting are described as follows:

" This feature can be enabled from Tools | VSCommands | Options | IDE Enhancements | Enable custom comments formatting This feature can be customized from Tools | Options | Environment | Fonts and Colors | VSCommands.Comment.* This feature is available in VSCommands Pro. "

Since the coloring for comments following "Todo" (which by default turns blue) is "VSCommands.Comment.Todo" (as described here: TODO comment font color in VS2010 with ReSharper and Productivity Power Tools), your comment "Notes" (which by default turns red) would likely be "VSCommands.Comment.Notes". I am unable to verify this with the Lite edition, however.

VSCommands Lite

Note, however, the "This feature is available in VSCommands Pro." part. I don't have Resharper or any plugins other than VSCommands 2010 Lite installed. The above-referenced settings "Enable custom comments formatting" and "Environment", are not visible in my options window. So it looks like you get the default settings for free, but can't turn it off or customize it without paying.

Documentation Source

As of today those instructions are listed under the heading "Comments Formatting" on the "VSCommands for Visual Studio 2010" (not 2012 or 2013) download page here:

http://visualstudiogallery.msdn.microsoft.com/d491911d-97f3-4cf6-87b0-6a2882120acf

I say "as of today" because the VSCommands documentation appears to be in flux, as I've encountered a higher than average number of broken links related to VSCommands documentation in general. E.g. this information used to be available here (http://vscommands.com/features/#CommentsFormatting), but as of today isn't.

Opinion

Since you didn't mention VSCommands in your question, I'll guess that you didn't opt to purchase the Pro version (or you would have remembered that you had installed it). So it may be that your only option to change that behavior would be to uninstall VSCommands.

The, "This feature is available in VSCommands Pro." line should probably read, "This feature can be customized or disabled in VSCommands Pro.", but then that would make this feature sound like a form of nag screen.

查看更多
登录 后发表回答