Tales from the Evil Empire

Bertrand Le Roy's blog


Bertrand Le Roy

BoudinFatal's Gamercard

Tales from the Evil Empire - Blogged

Blogs I read

My other stuff


You can do the TODOs today too!

Don't just leave your junk lying around. (c) Bertrand Le Roy 2002 If you’re anything like me, you probably litter your code with TODO comments, postponing random tasks for the sake of moving the project forward. And there is of course a non-zero probability that you are going to ship with those comments still in.

So I want to propose the following call to action to all readers of this blog: open your current project and start implementing what’s in those TODOs today.

Finding the TODOs is easy. In Visual Studio, do CTRL+SHIFT+F (search in files), make sure you are searching across the whole solution and search for “TODO”. In the results window, you can click on each result to open the file at the TODO comment location.

While working on a file, you can open the task list window (CTRL+\, CTRL+T), open that drop-down menu and choose “Comments”:

TaskList Comments

Once you’ve done that, Visual Studio brings you a list of all those TODO comments in the currently open files, which is easier on the eyes than the search results window:

Task List

You can now go through those one by one (double-clicking on the TODO in the task list takes you there) and delete the comments once you’ve implemented the feature they describe.

UPDATE: some commenters pointed out that the todo list is limited in scope. I updated the post. Resharper also apparently has a greater feature around that.


Jorge Alves said:

And use F8 to cycle through them!

# June 16, 2009 7:58 PM

Joe said:

//TODO: Follow Bertrand's advice.

# June 16, 2009 8:22 PM

Jack said:

Great! I didn't know how to use TODO before! I also use #warning instead, to remind me not to forget something important.

Thanks for sharing

# June 16, 2009 9:36 PM

Yash said:

Doesnt make any sense to me.

CTRL  + SHFT + F ... search for TODO.


# June 17, 2009 1:50 AM

MisterFantastic said:

Thanks, very nice tips

# June 17, 2009 3:10 AM

labilbe said:

One thing I don't like so much, is these TODOs are limited to the current selected project.

That's why i prefer the Resharper TODO explorer which allows to view the TODOs of the whole solution. Moreover you can parameter the strings to find (//HACK for instance).

# June 17, 2009 4:28 AM

sector0000h said:

This is cool. I actually used the TODO: but forgot where to retrieve the list. Thanks!

# June 17, 2009 5:07 AM

Danny Douglass said:

So simple, yet so helpful!

# June 17, 2009 8:36 AM

Zack Jones said:

I wish I hadn't read this. I did a search through the entire project source tree and found 632 TODO's in 186 files. Man I need to get busy! :)

# June 17, 2009 8:44 AM

Jon said:

Good tip. Mine key combination was defaulted to ctrl-\, ctrl-t. That seems like a strange default.

# June 17, 2009 10:06 AM

David Radcliffe said:

The Task list is Ctrl+W, T

# June 17, 2009 10:08 AM

Andrei Rinea said:

I've always seen in examples and templates the // TODO pattern but only later last year I found out this cool feature. Thanks for sharing!

# June 17, 2009 10:42 AM

jsalinase said:

Nice!, very useful.

# June 17, 2009 12:43 PM

CEY said:

probably the lamest tip ever.  you got to come stronger than this

# June 17, 2009 12:58 PM

Sathishne said:

Its a Cool tip! Thanks

# June 18, 2009 5:31 AM

helephant said:

I would but I'm too busy doing something more important that will help our software ship. :)

# June 22, 2009 4:34 AM