17

I can use the Ctrl+, shortcut to search for methods but will search among the entire project:

enter image description here

This lists all the classes in all files that have this method, and I want to search only in the current file, similar to Alt+M in VAssistX. Is there a shortcut for that?

I found Is there an easy way to jump right to a method within a file?, but it's for VS2012, and they only suggest Ctrl+F or Ctrl+,.

Note: I'm looking for true navigation, not Ctrl+F, and only within the current file, unlike Ctrl+,.

Community
  • 1
  • 1
sashoalm
  • 75,001
  • 122
  • 434
  • 781
  • You can still use the `Ctrl` `,` search if you type the classname first and then use `.` i.e. `TextGridFilter.GetFilter` will only show the `GetFilter` method from `TextGridFilter`. Is that acceptable? – default Oct 28 '16 at 14:17

4 Answers4

10

To expand on the answer by Matt Schley:

Ctrl + F2 -> Tab -> then start typing and it'll sift through the functions in the file.

I know you were probably looking for something else, but this is as good as it gets for what's built into Visual Studio. Maybe there's extensions available.

EDIT

This is a mapping for C#. The command name is Window.MovetoNavigation

For C++, it's default is Ctrl + F8

KidBilly
  • 3,408
  • 1
  • 26
  • 40
  • `Ctrl+F2` sets a bookmark for me, but it's probably because I had Visual C++ 6 mapping scheme set in Environment.Keyboard. Can you tell me which keyboard command it is, so I can map a shortcut to it? – sashoalm Oct 28 '16 at 14:27
  • @sashoalm A person from this post said `Ctrl+F8` for C++ settings. http://stackoverflow.com/questions/1454642/is-there-a-hotkey-in-visual-studio-to-open-the-member-drop-down-list – Alex Oct 28 '16 at 14:33
  • 1
    @CrazyPaste Thanks, I figured it out. The navigation bar was missing from my VS2015, I had to reenable it - http://stackoverflow.com/a/1441255/492336. The hotkey was indeed `Ctrl+F8`. – sashoalm Oct 28 '16 at 14:42
4

Not sure if this is what you're looking for, but there is a dropdown menu right above the code editor window that lists all methods and properties in the current file.

Try Ctrl + F2 to active the navigation bar, then tab over twice and you can scroll through the dropdown.

Matt Schley
  • 187
  • 1
  • 8
4

For VS2019 you can use Alt + \ for object search.

Metaller
  • 504
  • 3
  • 10
2

From https://learn.microsoft.com/en-us/visualstudio/ide/go-to?view=vs-2019, it says Ctrl+1, Ctrl+M for Go to the specified member. You can add your own combination to this command by going to Tools -> Options -> Keyboard and choosing Edit.GoToMember. For me it works just perfect.

enter image description here

RustemMazitov
  • 958
  • 1
  • 10
  • 15
  • I believe this feature is now ruined due to https://devblogs.microsoft.com/visualstudio/introducing-a-new-way-to-search-your-code-and-visual-studio-features/ . There is no longer a way to go to methods within a file, only all methods. – Jon Mar 22 '23 at 12:33