How do I add a high-priority TODO comment in Visual Studio?

26,753

Solution 1

The priority of the task depends on the keyword you use to tag it. You can see and edit a list of keywords and their priorities by going to Tools->Options->Environment->Task List.

For example, on my installation, I've got HACK, TODO and UNDONE as normal priority, and UnresolvedMergeConflict as high priority.

If you want to add a new tag, type it into the "Name" box, choose a priority, and then click "Add".

Solution 2

A cheap hack is to always put a priority just after the the TODO tag, then sort by description. Only use priority 1-9 to avoid alphabetic sorting confusion.

Any comments without a priority will drop to the bottom.

(Click to enlarge the image)

TODO priority hack

Share:
26,753
aarona
Author by

aarona

Updated on December 04, 2021

Comments

  • aarona
    aarona over 2 years

    Adding a comment such as this:

    // TODO: Refactor this code
    

    ...creates a task in the Task List that I can view etc. There is a column labeled ! that lets you sort these tasks by priority.

    How can I set a specific task's priority?

  • aarona
    aarona about 13 years
    I see these options.. but the Add button is disabled! Do you have the same behavior?
  • thomson_matt
    thomson_matt about 13 years
    Type in a name in the "Name" box, and then the "Add" button will be enabled.
  • aarona
    aarona about 13 years
    Thanks. Also, what a way to start your StackOverflow exp with 80 rep :D
  • toddmo
    toddmo over 9 years
    Microsoft, that's dumb. I had to add 6 more tags, 3 high and 3 low.
  • Richard C
    Richard C over 7 years
    This is one way of doing it, but it assumes that only one person is going to be looking at the task list, or all team members have done the same setup. Is there a way to configure this on a project or solution level so that everyone getting the source has it?
  • AmiNadimi
    AmiNadimi about 7 years
    I have added a new tag and i want it to get BLUE! just as TODO and BUG tags . anyone knows how ?
  • AmiNadimi
    AmiNadimi about 7 years
    OK! Found it myself. it was a resharper thing so i went to resharper menu > Options > Tools > To-do Items then add the item, give it a title and a color and also a regular expression like (?<=\W|^)(?<TAG>your custom tag)(\W|$)(.*) and hit save.
  • Preza8
    Preza8 over 4 years
    By the way, it does not prefer high priority but judges it by the first tag found. If you use // TODO BUG and BUG is your high priority task tag, it will still be normal because TODO is first and it is normal. I find this a little dumb.
  • Donny McCoy
    Donny McCoy over 4 years
    Logged in just to acknowledge this and raise it back up in case others are searching. Having used the TODO for numerous versions, I just learned something new, and I'm fast becoming an old dog!
  • user3285954
    user3285954 almost 4 years
    Are the custom tags working in VS2019? I added a few and none show up in task list.