TODO Comments in the Task List

Tips Search

TODO Comments in the Task List

  • Comments 21

Versions:  2008,2010
Published:  6/7/2010
Code:  vstipTool0029

 

Ever been writing some code and you want to leave a reminder to yourself to do something on a particular line or area?  Did you know about the "to do" comment feature?  It seriously rocks if you have never used it AND, because it goes in the source code, everyone can have access to the information when you do you check-in!

 

So here's how it works:  In VB you just put any comment in that begins with the letters "todo" (case doesn't matter):

image

 

In C#, it's pretty much the same thing (again, case doesn't matter):

image

 

C++ requires that the “TODO” be in upper-case or it will not show up in the Task List:

clip_image002 

 

 

In C++ for VS2010 you have to explicitly turn this feature on.  Go to Tools | Options | Text Editor | C/C++ | Formatting | Miscellaneous and change Enumerate Comment Tasks to true:

clip_image004 

 

 

Regardless which language you use the result is a nice entry in your Task List:

clip_image006 

 

NOTE:  In order to see these items, you have to click the drop-down list in the Task List and choose Comments as shown here.

  • I've failed to make it work in pure C++ - does it requires managed language?

  • Dmitry,

    I does look like it only works in C# and VB.  I've pinged the C++ team to see when/if this feature is planned anytime soon.

    Z

  • In C++, the ‘comments tasks’ in the Task List window is turned off by default due to performance reasons. You can turn this feature on from Tools->Options->Text Editor->C/C++->Formatting-> Miscellaneous->Enumerate Comment Tasks.

    We apologize for the inconvenience.

    Sumit Kumar

    Visual C++ Team

  • Thanks Sumit! :)

    I've updated the post to reflect this info.

    Z

  • Alright, thx for the tip with c++ ;)

  • When I open my VS2010, the comments aren't there. Once I open a page that has TODO comments, then they show up in the list. Is that normal?

  • When you open the solution it should populate with all the todo comments so it looks like you may have an issue with the loading of the comments.

  • I've gotten it to work in C++ Add a colon (:) to the end of TODO like so:

    TODO: Work needs done here

  • Brett -- By default it should not require any colons at the end unless the token has been modified.  

    Z

  • It would be nice to be able to export all TODO type items (the user can define other tags to flag in the comments section such as TESTCODE). If I could export them, I would put them in our issue tracker system to help identify all of the work that needs to be addressed in the project.

  • Gary -- Yep I agree.  I'm going to ping the VS Team and find out if that is in the plan for a future version.

    Z

  • In VS2008, does this work for C++? Miscellaneous is not in the formatting options.  

  • Rick -- Looks like that one got by me.  I'll update the post.  :)

    Z

  • maybe also worth mentioning is //hack instead of //todo for temporarily made (custom) changes

  • Ok, why it is not in help? Help tells about Tools/Options/Environment/Task List only.

Page 1 of 2 (21 items) 12
Leave a Comment
  • Please add 5 and 4 and type the answer here:
  • Post