16.4. Bookmarks and the Bookmark Window

Bookmarks in Visual Studio 2008 enable you to mark places in your code modules so you can easily return to them later. They are represented by indicators in the left margin of the code, as shown in Figure 16-15.

Figure 16.15. Figure 16-15

To toggle between bookmarked and not bookmarked on a line, use the shortcut Ctrl+K, Ctrl+K. Alternatively, you can use the Edit Bookmarks Toggle Bookmark menu command to do the same thing.

Remember that toggle means just that. If you use this command on a line already bookmarked, it will remove the bookmark.

Figure 16-15 shows a section of the code editor window with two bookmarks set. The top bookmark is in its normal state, represented by a shaded blue rectangle. The lower bookmark has been disabled and is represented by a solid white rectangle. Disabling a bookmark enables you to keep it for later use while excluding it from the normal bookmark-navigation functions.

To disable a bookmark, use the Edit Bookmarks Enable Bookmark toggle menu command. Use the same command to re-enable the bookmark. This seems counterintuitive because you actually want to disable an active bookmark, but for some reason the menu item isn't updated based on the cursor context.

You may want to set up a shortcut for disabling and enabling bookmarks if you plan on using them a lot in your code management. To do so, access the Keyboard Options page in the Environment group in Options and look for Edit.EnableBookmark.

Along with the ability to add and remove bookmarks, Visual Studio provides a Bookmarks tool window, shown in Figure 16-16. You can display this tool window by pressing Ctrl+K, Ctrl+W or via the View Bookmark Window menu item. By default, this window is docked to the bottom of the IDE and shares space with other tool windows, such as the Task List and Find Results windows.

Figure 16.16. Figure 16-16

Figure 16-16 illustrates some useful features of bookmarks in Visual Studio 2008. The first feature is the ability it gives you to create folders that can logically group the bookmarks. In the example list, notice a folder named Old Bookmarks contains a bookmark named Bookmark3.

To create a folder of bookmarks, click the "new folder" icon in the toolbar along the top of the Bookmarks window (it's the second button from the left). This will create an empty folder (using a default name of Folder1, followed by Folder2, and so on) with the name of the folder in focus so that you can make it more relevant. You can move bookmarks into the folder by selecting their entries in the list and dragging them into the desired folder. Note that you cannot create a hierarchy of folders, but it's unlikely that you'll want to. Bookmarks can be renamed in the same way as folders, and for permanent bookmarks renaming can be more useful than accepting the default names of Bookmark1, Bookmark2, and so forth. Folders are not only a convenient way of grouping bookmarks; they also provide an easy way for you to enable or disable a number of bookmarks in one go, simply by using the checkbox beside the folder name.

To navigate directly to a bookmark, double-click its entry in the Bookmarks tool window. Alternatively, if you want to cycle through all of the enabled bookmarks defined in the project, use the Previous Bookmark (Ctrl+K, Ctrl+P) and Next Bookmark (Ctrl+K, Ctrl+N) commands. You can restrict this navigation to only the bookmarks in a particular folder by first selecting a bookmark in the folder and then using the Previous Bookmark in Folder (Ctrl+Shift+K, Ctrl+Shift+P) and Next Bookmark in Folder (Ctrl+Shift+K, Ctrl+Shift+N) commands.

The last two icons in the Bookmarks window are "toggle all bookmarks," which can be used to disable (or re-enable) all of the bookmarks defined in a project, and "delete," which can be used to delete a folder or bookmark from the list.

Deleting a folder will also remove all the bookmarks contained in the folder. Visual Studio will provide a confirmation dialog to safeguard against accidental loss of bookmarks. Deleting a bookmark is the same as toggling it off.

Bookmarks can also be controlled via the Bookmarks sub-menu, which is found in the Edit main menu. In Visual Studio 2008 bookmarks are also retained between sessions, making permanent bookmarks a much more viable option for managing your code organization.

Task lists are customized versions of bookmarks that are displayed in their own tool windows. The only connection that still exists between the two is that there is an Add Task List Shortcut command still in the Bookmarks menu. Be aware that this does not add the shortcut to the Bookmarks window but instead to the Shortcuts list in the Task List window.

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

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