views:

460

answers:

3

We all sometimes have to write potentially dangerous, unsafe or just poorly written piece of code. Usually it is done in a hurry and needs to be rewritten later.

My question is: How can I easily and visually mark this code in VS 2008?

For example, I'm using Mindjet MindManager for planning and I love how easily I can put a predefined graphical marker on any topic: red flag for "dangerous!", half-filled square for "50% done", etc. Then I can set up a filter and see i.e. all my topics marked as "important" or all topics with progress > 75%.

I want to have something like that in Visual Studio. I know about "TODO:" comments, but they do not have any markers and cannot be filtered by their importance.

+5  A: 

I use "TODO" followed by a priority indicator, "P1", "P2" etc. I can then sort the TODO list into the correct order.

Christian Hayter
+5  A: 

Let the compiler throw warnings:

#if RELEASE
#warning This has to rewritten later
#endif

http://msdn.microsoft.com/en-us/library/963th5x3(VS.71).aspx

Dykam
+7  A: 

Take a look at Tools->Options, Task List. It has:

  • HACK
  • TODO
  • UNDONE
  • UnresolvedMergeConflict

The first three have "Normal" priority, the last has high priority. These can be sorted in the Task List (View->Task List). These can be customized, and you can add your own.

ReSharper goes further, permitting the keywords to match via regular expressions, and to show up with a particular color and icon in their To-do Explorer.

John Saunders
+1. Useful in teamwork.
rockeye
It is a really nice option. But I'm more interested in having something like red background for whole unsafe code block. I guess there should be a free simple addin doing such thing.
Dmitry
You can probably do that fairly easily with Visual Studio 2010. They've made the editor much, much more extensible, and they have several really nice examples. The editor now uses WPF to render, so you're not even limited to text effects, but can add graphics of any kind. For instance, you could probably change the background color based on _how_ bad the code region is (and even use a nice gradient)!
John Saunders