views:

678

answers:

4

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 right is a Method Name combobox. Those are the tooltip descriptions but are a little misleading for instance the Method Name box shows all the methods, properties, events etc in the current file. Do these features have official names?

I use the method name combobox a lot because I'll often know that there's a property or method or something in the file I'm working in, but can't remember the exact name, so the dropdown gives me a quick way to browse for what I need. But I can't find a way to assign a keyboard shortcut to this combobox. Is there a keyboard shortcut or an alternative VS feature that I can use to get this functionality?

A: 

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

David in Dakota
A: 

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.

Jugglingnutcase
A: 

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 ReShareper right after it ;-)

Piotr Owsiak
+1  A: 

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.

qntmfred