Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tag important code regions in Visual Studio?

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.

like image 670
Dmitriy Zhukov Avatar asked Jul 10 '09 11:07

Dmitriy Zhukov


People also ask

What is region in Visual Studio?

Use the #Region directive to specify a block of code to expand or collapse when using the outlining feature of Visual Studio IDE. You can place, or nest, regions within other regions to group similar regions together.

How do you define a region in Javascript?

By marking a section of code (regardless of any logical blocks) and hitting CTRL + M + H you'll define the selection as a region which is collapsible and expandable.


1 Answers

Take a look at Tools->Options-->Environment, 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.

like image 144
John Saunders Avatar answered Jan 01 '23 22:01

John Saunders