Share via


Annotating Code

In some Visual Studio programming languages, when you add comments with comment tokens to your code, you automatically add shortcuts to the Task List window. Double-click any comment displayed in the Task List to move the insertion point directly to the line of code where the comment begins.

Note   Comments in HTML, .CSS, and .XML markup are not displayed in the Task List.

To add a comment hyperlink to the Task List window

  1. Enter the comment marker appropriate for your development language.

  2. Enter TODO, HACK, UNDONE, or a custom comment token string.

  3. Add the comment text.

    Examples:

    // TODO Fix this function.
    

    - or -

    ' HACK Fix this function.
    

    A hyperlink to your comment will appear in the Task List.

To create a custom comment token

A comment token is a character string that can be used in addition to the pre-defined tokens TODO, HACK, or UNDONE as your personal marker for notes in your code.

Note   Characters permitted as comment tokens include alphanumeric characters, $, _, (, and ).

  1. On the Tools menu, choose Options.
  2. Choose Environment, and then choose Task List.
  3. In the Comment tokens area, type a Name for your custom token.
  4. From the Priority list, choose Normal, Low, or High.
  5. Click Add, and then choose OK.

To add a shortcut to a line of code

  1. Place the insertion point in the line of code.

  2. On the Edit menu, choose Bookmarks.

  3. On the Bookmarks menu, choose Add Task List Shortcut.

    A blue arrow icon appears in the left margin of the editor to mark the shortcut. In the Task List, a new shortcut entry displays text from the bookmarked line.

    Note   You can change the description of a shortcut in the Task window without modifying the bookmarked code.

To remove a shortcut from a line of code

  1. With the insertion point positioned within the marked line of code, click the link to open the editor.
  2. On the Edit menu, choose Bookmarks.
  3. On the Bookmarks menu, choose Remove Task List Shortcut.

To change a comment or remove it from the Task List

  1. Open your document in a code editor.
  2. Modify or delete the comment in your code.

See Also

Finding Lines of Code | Navigating within the Integrated Development Environment | Task List Window