Posts Tasklist Comments / TODO in Visual Studio – Tip Of Week #14
Post
Cancel

Tasklist Comments / TODO in Visual Studio – Tip Of Week #14

Task list comments are a great way to remind you or others of something that still needs to be done or something that may need to be revisited for enhancement.

The task list (Ctrl-Alt-K/View.TaskList) is a handy tool that is most often used to view errors or warnings from the compilation of your code.

The task list also has another use; it can be used to leave reminders for yourself or other members of your team in comment form.

You can use this comment anywhere throughout your code, and they will show up in the task list when the file with the comment is open.

//

// TODO: Add addition logic here

//

To list this in your task list first make sure that the task list is configured to show comments, and then you will see in the task list that this comment has been added as an item.

You will see a drop-down list at the top of the task list that lets you choose what should be displayed in the task list.

You can then click on this comment and be taken to the place where you need to add code.

You can use shortcuts to step back and forth between tasks as well. The View.NextTask ( Ctrl-Shift-F12) and View.PreviousTask (no default shortcut) commands can be used to step through the tasks listed in the task list.

You can also click in the area at the top of the task list with the text “Click here to add a new task,” or  you can click the Create User Task button. This creates a user task for you and acts much like the tasks portion of Outlook. You can also tag any line in your project as a task by using the Edit.ToggleTaskListShortcut (Ctrl-K, Ctrl-H) command. Whenever you call this command, it will add a shortcut to the task list pointing to this line of code. You can then add text that says what should be done to the line of code. It is a quick and easy way to add something to the task list to tackle later on. These tasks will appear only on your system and not on the systems of your team members.

This post is licensed under CC BY 4.0 by the author.