Obey my dog

Create To Do Lists from Comments in TextMate

Sunday, May 13th, 2007 at 19:47 Sunday, May 13th, 2007 at 19:47

Test Driven Developemnt and GTD both employ To Do lists to keep track of tasks. I've been a big fan of these task lists, but I've found that I have way too many items on my list to keep them organized. These days I prefer to keep my development-related todo items in the comments of the source code. This allows me to associate the todo item with a specific place in the code, while adding additional documentation to the project. I use a couple of different markers to denote different types of todo items, all based on the C-style single line comment, //:

  1. //! Check this line later on.
  2. //x Delete this line later; only needed during development.
  3. //+ To Do item; an unfinished task.
  4. //- Refactor this line later on.
//! Check this line later on.
//x Delete this line later; only needed during development.
//+ To Do item; an unfinished task.
//- Refactor this line later on.

It's become almost second nature to type //! after a line I think might need some attention, or //x after a line that needs to be removed before going to production. You can do a search for these specific comments to immediately find all lines that need to be reviewed. //- especially has made my life easier; we all know that "Premature optimization is the root of all evil", but I've always been hesitant to leave optimization until later, fearing that I would forget to do it. Now I just mark the line with the comment and forget it, knowing that I'll come back to it later.

The one tool that really makes these comments useful is the TODO bundle in TextMate. After modifying the bundle a bit to search for my comments, I can now type ⌃⇧T to get a complete list of all of these todo items, with links to the exact lines where they appear. Here is how I modified the "Show TODO List" command:

TODO Bundle Modifications

You can change the bundle to search for any specific string, such as //todo or //fixme, so you don't have to change your current practice to take advantage of this. This is just another reason why I am completely hooked on TextMate.

Comment On This Post

IP addresses are logged with all comments for security.

HTML Tags Allowed: <b>, <strong>, <i>, <em>, <br>, <a href="">, <code> and the closing tags for each. Paragraphs and line breaks are added automatically.

Comment Preview

Wednesday, July 23rd, 2008 at 10:45 #1


Recent Posts

Navigation