Visual Studio keyboard shortcut for Method Name combobox

后端 未结 4 1686
一个人的身影
一个人的身影 2020-12-17 17:12

In VS 2008 (and prior versions as well I believe) when in the code editor there are 2 comboboxes at the top of the editor. On the left is a Class Name combobox and on the ri

相关标签:
4条回答
  • 2020-12-17 17:27

    I frequently use the "collapse definitions" feature which you can access by typing the following keyboard sequence:

    Ctrl + M, O

    If you have code regions set up this will also collapse those and allow you to quickly zoom to different portions of your code.

    I would also recommend setting up bookmarks in your code to assist navigating around easily (this works especially well for multiple files). Put your cursor on the line of code and use the following keyboard sequence:

    Ctrl + K, K

    Once you've got your bookmarks set, you can use the following to skip through all your bookmarks:

    Ctrl + B, N

    0 讨论(0)
  • 2020-12-17 17:29

    An alternative way would be DPack (a free Visual Studio add-in). It allows you to navigate very quickly.

    What you should first look at is Alt + U and Alt + M keyboard shortcuts, although I recemmend you going through it's options and looking at DPak's website for a brief overview.

    Personally I love DPack and it's the 1st thing I add to my VS (with ReSharper right after it ;-)

    0 讨论(0)
  • 2020-12-17 17:39

    Thanks to Jeff's Keyboard Shortcut Summary Macro, I discovered that Ctrl + F2 is mapped to a MovetoNavigationBar command, which pops me into the "Class Name combobox." Add a tab and I'm in the Method Name combobox.

    0 讨论(0)
  • 2020-12-17 17:43

    You can try the IncrementalSearch and ReverseIncrementalSearch mappings for this. It's not as straightforward as using the mouse on the combobox, but it will get you to where you're going. Just search and continue hitting the shortcut until you get to the right one.

    The mapping is taken from emacs, which I got used to in college and enjoy.

    The problem I run into with this is if I have a lot of similarly named methods and variables, then I have to search through to find the right one.

    So to find the definition I just use Sub methodName() in the search.

    This is nice for finding code fragments/methods/vars quickly without having to take your hands off the keyboard.

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