Sunday, January 29, 2012

TaskList in Visual Studio - Making it better

It was great to come across a new feature in Visual Studio - The TaskList. Well, yes it isn't new but, it certainly was new to me. I had never really come across this wonderful feature until last week when secretGeek blogged that code would suck less if the compiler could raise an error when a // TODO token was detected. A comment from Goran indicated that it was completely possible with the current versions of Visual Studio.
A //TODO: token.
Are shown in VS if you click TaskList. Couldn’t live without this one :)
Yeah, sure. Can’t live without it. Although the compiler doesn’t throw you an error, it indicates all parts of code where such tokens appear and hence can be taken care of easily.

How To Use
You can use the TaskList comments for:
  • Features to be added
  • Problems to be corrected
  • Classes to implement
  • Place-markers for error handling code
  • Reminders to check in the file
Add your comment in the code preceded by the token.    

Once done, open up the TaskList from the View menu.

Once the TaskList is up you will see something like this.

The TaskList also allows custom tokens to be included. Go to Tools –> Options –> Environment –> TaskList.

User Tasks
You can add your own tasks in the TaskList by selecting the ‘User Tasks’ selection from the dropdown list on the TaskList toolbox. These tasks aren’t associated with code, but will allow users to add their own high level tasks.

Extending the TaskList
I would like to see the following additional options in the TaskList:
  • Task Alarms – which would associate an alarm with a high priority comment to help just in case you forget to take care.
  • User Tasks to be more specific (by having a file anchor like ‘Comments’) to allow user tasks to be associated with a particular line in code.
And no, I’m not waiting on Microsoft to extend it in some other version of Visual Studio. I’m starting right away to write a package that would do this for me, hopefully.

More Things to Remember
With Visual Basic projects, the Task List displays all of the comments in the project. With Visual C# and Visual J# projects, the Task List displays only the comments that are found in the files currently opened for edit. With Visual C++ projects, the Task List displays only the comments that are found in the file currently active in the editor.

No comments:

Post a Comment