9.5. Task List Comments

The Task List window is a feature of Visual Studio 2008 that allows you to keep track of any coding tasks or outstanding activities you have to do. Tasks can be manually entered as User Tasks, or automatically detected from the inline comments. The Task window can be opened by selecting View Task List, or by using the keyboard shortcut CTRL+, CTRL+T. Figure 9-4 shows the Task List window with some User Tasks defined.

User Tasks are saved in the solution user options (.suo) file, which contains user-specific settings and preferences. It is not recommended that you check this file into source control, and as such, User Tasks cannot be shared by multiple developers working on the same solution.

Figure 9.4. Figure 9-4

The Task List has a filter in the top-left corner that toggles the listing between Comment Tasks and manually entered User Tasks.

When you add a comment into your code with text that begins with a comment token, the comment will be added to the Task List as a Comment Task. The default comment tokens that are included with Visual Studio 2008 are TODO, HACK, UNDONE, and UnresolvedMergeConflict.

The following code listing shows a TODO comment. Figure 9-5 shows how this comment appears as a Task in the Task List window. You can double-click the Task List entry to go directly to the comment line in your code.

using System;
using System.Windows.Forms;

namespace CSWindowsFormsApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {

InitializeComponent();

            //TODO: The database should be intialized here
        }
    }
}

Figure 9.5. Figure 9-5

The list of comment tokens can be edited from an Options page under Tools Options Environment Task List, as shown in Figure 9-6. Each token can be assigned a priority — Low, Normal, High. The default token is TODO and it cannot be renamed or deleted. You can, however, adjust its priority.

Figure 9.6. Figure 9-6

In addition to User Tasks and Comments, you can also add shortcuts to code within the Task List. To create a Task List Shortcut, place the cursor on the location for the shortcut within the code editor and select Edit Bookmarks Add Task List Shortcut. This will place an arrow icon in the gutter of the code editor, as shown in Figure 9-7.

Figure 9.7. Figure 9-7

If you now go to the Task List window you will see a new category called Shortcuts listed in the drop-down list. By default the description for the shortcut will contain the line of code (see Figure 9-8); however, you can edit this and enter whatever text you like. Double-clicking an entry will take you to the shortcut location in the code editor.

Figure 9.8. Figure 9-8

As with User Tasks, Shortcuts are stored in the .suo file, and therefore aren't checked into source control or shared among users. Therefore they are a great way to annotate your code with private notes and reminders.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.83.176