84

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?

nikodaemus
  • 1,918
  • 3
  • 21
  • 32
aarona
  • 35,986
  • 41
  • 138
  • 186

3 Answers3

116

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".

thomson_matt
  • 7,473
  • 3
  • 39
  • 47
  • 2
    I see these options.. but the Add button is disabled! Do you have the same behavior? – aarona Mar 21 '11 at 16:36
  • 16
    Type in a name in the "Name" box, and then the "Add" button will be enabled. – thomson_matt Mar 21 '11 at 16:38
  • Thanks. Also, what a way to start your StackOverflow exp with 80 rep :D – aarona Mar 21 '11 at 16:42
  • Microsoft, that's dumb. I had to add 6 more tags, 3 high and 3 low. – toddmo Sep 27 '14 at 23:27
  • 3
    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? – Richard C Sep 08 '16 at 14:35
  • I have added a new tag and i want it to get BLUE! just as TODO and BUG tags . anyone knows how ? – AmiNadimi Feb 19 '17 at 16:55
  • 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|^)(?your custom tag)(\W|$)(.*)` and hit save. – AmiNadimi Feb 19 '17 at 17:18
  • 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. – Preza8 Sep 03 '19 at 15:45
  • 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! – Donny McCoy Sep 14 '19 at 01:38
  • Are the custom tags working in VS2019? I added a few and none show up in task list. – user3285954 Jun 24 '20 at 16:12
57

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

Community
  • 1
  • 1
RockResolve
  • 1,423
  • 21
  • 29
2

A very simple way/hack to define the priority is the number of Os at the end of TODO, then you sort the task List by "Description".

Pros:

  • No need to restrict yourself at 1 or 2 digit numbers
  • It's funnier than 1-9

I got this idea from a video by Tsoding where he talks about it being an extension for emacs. Link in the video description.