Is there an easy way to jump right to a method within a file?

前端 未结 7 484
生来不讨喜
生来不讨喜 2021-01-12 04:42

I just installed Visual Studio 2012 and am having a hard time navigating within a file. What I\'d like to be able to do is type in one or more characters of a class, method

相关标签:
7条回答
  • 2021-01-12 05:09

    In VS 2017 (not sure, may be also work for some previous versions):

    • Ctrl + T (or Ctrl + ,) to open Go To All window, then
    • Ctrl + Alt + C to enable current document scope. There is an appropriate button in Go To All window that displays document stope is enabled or not.
    0 讨论(0)
  • 2021-01-12 05:18

    With Resharper you can use Ctrl+F12 to navigate to a member of the current class, method or field.

    0 讨论(0)
  • 2021-01-12 05:21

    So here is a summary of what I've found out after some research.

    DPack for Visual Studio 2012: Currently, it's in beta but works perfectly fine. Since this is a plugin, it won't run on the Express Edition of Visual Studio.

    Ctrl+F: The standard Ctrl+F dialog has been completely re-invented in Visual Studio 2012 and is more of an inline search, jumping around in your document as you type. It's fairly usable for finding symbols, but would also find any matching text in the document, including references, string constants, comments, whatever. For this reason, it's probably not the best way to quickly jump right to a symbol.

    Ctrl+Comma: This is also a new VS2012 feature, however it's not available in Visual Studio Express Edition. This allows you to quickly find a symbol within your solution. It works fairly well, though for larger projects it might be information overload.

    Ctrl+Semicolon: The Solution Explorer now allows you to filter by filename using the Ctrl+; shortcut key. This makes finding files quick and easy, however will not search symbols within the current file. This is more analogous to DPack's Ctrl+U feature.

    Class View Search: Within Class View mode (Ctrl+Shift+C), you can also search for class names or symbols within your entire solution. However, there does not appear to be a keyboard shortcut to use this search, nor can you just search the currently opened file. Also, you have to enter your query and press enter to display the results, rather than just filtering as you type.

    Class/Method Dropdowns: Like previous versions of Visual Studio, code files have dropdowns just below the file tabs that display classes and methods within the current file. This is fairly unusable for quickly jumping to any method in the document, as you would first need to select which class the symbol is defined in, and then select the symbol itself. Also, there's no keyboard shortcut that I could find, nor is there an easy way to filter the items in the list by typing part of the symbol name.

    0 讨论(0)
  • 2021-01-12 05:27

    If I understood correctly, you can do that via the dropdown menu on the right, just above the coding window.

    http://i.imgur.com/uv96R.png

    I don't know any other way, but that doesn't mean there isn't. Hope this helps.

    0 讨论(0)
  • 2021-01-12 05:29

    You can use Ctrl+, - just type whatever you want in the box and it will find you the corresponding symbols.

    0 讨论(0)
  • 2021-01-12 05:31

    I'm using VS Community 2019. I found this combination key:

    • Go to member: Ctrl + 1, Ctrl + M
    • Go to symbol: Ctrl + 1, S
    0 讨论(0)
提交回复
热议问题