Is there a way to bookmark code in a Visual Studio project?

后端 未结 10 1556
既然无缘
既然无缘 2020-12-12 20:25

In various projects there are certain parts I will keep jumping to. Is there a way to effectively \"bookmark\" these parts, so I can quickly jump back to a certain line in a

相关标签:
10条回答
  • 2020-12-12 20:53

    Recent versions of Visual Studio (at least from Visual Studio 2010) have all the comfort for bookmarking. Here is my workflow:

    First, you should remember two shortcuts, Show Bookmark Window and Toggle Bookmark. In my setup it is Ctrl + W + B and Ctrl + B + T respectively.

    Second, set the Bookmark window to autohide. That step was important for me to finally make bookmarking easy and comforting.

    That's how I use bookmarks:

    When I am in a position of interest, I Toggle Bookmark and Show Bookmark Window, then press F2 and rename entry — using reasonable names is very helpful for easy navigation.

    When I want to get to another position of interest, I Show Bookmark Window, navigate to needed entry, press enter, and voila, I am there.

    For me, discovering autohide of a bookmark window was cricial: it allows to quickly get the full view of points of interest, and then it leaves and returns focus to the editor.

    0 讨论(0)
  • 2020-12-12 21:01

    There is also shortcuts: Ctrl-K, Ctrl-H - sets or removes a shortcut in the tasklist to the current line.

    List of all the shortcuts you can see in Task List window. To open it click View - Task List in menu or press Ctrl-\, T. In that window you can select User Tasks, Shortcuts or Comments (not in VS2015).

    0 讨论(0)
  • 2020-12-12 21:02

    Go to View | Toolbars and check the Text Editor toolbar so it shows up. It has toolbar buttons to Toggle (create/delete) a bookmark on the current line Ctrl-B, T, as well as navigation to the next/prev bookmark, where the navigation is scoped to the solution, folder, or document, depending on which button you use.

    Once you have a bookmark created, go to View | Other Windows and select the Bookmark Window (or just press Ctrl-W, B). That will display the list of all the bookmarks. You can double-click any bookmark to jump to it, or use the toolbar button in the Bookmark window for prev/next.

    You can also name/rename your bookmarks in the Bookmark window. Right-click on the name and choose rename, or select the name and click it again to enter in to the edit mode.

    0 讨论(0)
  • 2020-12-12 21:03

    In Visual Studio, you can set Bookmarks in the code.

    To jump between Bookmarks:

    Ctrl + K + N (for next)

    and

    Ctrl + K + P (for previous)

    To toggle a Bookmark on/off for a line:

    Ctrl + K + K

    0 讨论(0)
提交回复
热议问题