Freigeben über


TODO Comments in the Task List

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.

Comments

  • Anonymous
    June 12, 2010
    I've failed to make it work in pure C++ - does it requires managed language?

  • Anonymous
    June 12, 2010
    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

  • Anonymous
    June 15, 2010
    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

  • Anonymous
    June 17, 2010
    Thanks Sumit! :) I've updated the post to reflect this info. Z

  • Anonymous
    August 18, 2010
    Alright, thx for the tip with c++ ;)

  • Anonymous
    December 09, 2010
    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?

  • Anonymous
    December 11, 2010
    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.

  • Anonymous
    December 20, 2010
    I've gotten it to work in C++ Add a colon (:) to the end of TODO like so: TODO: Work needs done here

  • Anonymous
    February 04, 2011
    Brett -- By default it should not require any colons at the end unless the token has been modified.   Z

  • Anonymous
    February 12, 2011
    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.

  • Anonymous
    February 12, 2011
    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

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

  • Anonymous
    February 16, 2011
    Rick -- Looks like that one got by me.  I'll update the post.  :) Z

  • Anonymous
    February 16, 2011
    The comment has been removed

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

  • Anonymous
    July 04, 2012
    C++ programmer says thanks for the post. I

  • Anonymous
    September 10, 2012
    This works for me. Problem is that task list keywords are probably being searched only in opened files. But it works for me.

  • Anonymous
    September 27, 2012
    The comment has been removed

  • Anonymous
    May 01, 2013
    If you use it in c++, you need a colon(:) and a space( ), eg: //TODO: just for test.

  • Anonymous
    July 17, 2013
    I am working in windows7 and vs2012 and Task List does not work

  • Anonymous
    November 25, 2013
    Comments appear for the entire solution (VS2010). I'd like to be able to show TODO comments per-project: otherwise, the noise to signal ratio (in solutions with tens of projects) makes the tool very uncomfortable to use. Maybe in a SP sometime?

  • Anonymous
    July 12, 2015
    Hey Now Zain; Still enjoying your info about VS; this TODO is classic and a good reference. Thanks; Catto