dotPeek 2016.1 Help

Go to Declaration

Navigate | Go To Declaration

This command allows you to navigate to the declaration of a symbol from any symbol usage. You can invoke this command from the code viewer, from the File Structure Window and other tool windows.
To navigate in the opposite direction (symbol usages) you can invoke the Go to Declaration command when you are already on the symbol declaration, or you can use the Go to Usages of Symbol command.

If you navigate from a usage of a method or a property, which is declared in an interface, the command will get you not to the interface itself, but to the exact implementation that is used.

To navigate to a declaration of a symbol

  1. Place the caret on a symbol in the code viewer or select the symbol in a tool window.
  2. Choose Navigate | Go to Declaration on the main menu, press Ctrl+B, or click the symbol holding the Ctrl key.
  3. If the symbol has only one declaration, dotPeek will navigate to it directly.
  4. If the symbol several declarations (e.g. it is a partial class), they are listed in the drop-down list. Do one of the following:
    • Click on the desired item to open it in the editor.
    • Select the desired item by pressing UpArrow and DownArrow and the press Enter to open it in the editor.
    • To view and analyze the list of matched items in the Find Results Window, click Show in Find Results go_to__show_in_find_results or press + on the numeric keypad.

Usage-aware behavior

As Go to Declaration is one of the most frequently used commands, dotPeek streamlines your navigation experience allowing you to use this command in navigation scenarios related to usages of the declared symbol:

  • You can invoke the Go to Declaration command when your caret is already at a symbol declaration. In this case, dotPeek will show a short version of the Navigate to menu only including the command for iterating usages and commands for navigating to other members in the inheritance hierarchy (Base Symbols, Derived Symbols).

    If you choose Iterate usages in the Navigate to menu, dotPeek enables 'usage iteration' mode designated with a small pop-up in the upper-left corner of the code viewer:

    Usage-aware behaviour of Go to Declaration
  • Right after you have used the Go to Declaration command on a symbol usage and landed on its declaration, dotPeek enables the 'return to usage' mode

    In this case, you can invoke Go to Declaration again to return to the usage. If you repeat this command yet another time, dotPeek will switch the 'usage iteration' mode.

You can always exit the 'return to usage' and 'usage iteration' modes by pressing Esc or clicking Close (x) in the usage iteration pop-up.

In the 'usage iteration' mode, you can navigate through the symbol usages as follows:

  • Invoke Go to Declaration to go to the next usage, if any, and so on, subsequently navigating through all symbol usages. The total number of symbol usages in the solution appears in the usage iteration pop-up.
  • Use Next and Back buttons in the usage iteration pop-up (Ctrl+Alt+PageDown/Ctrl+Alt+PageUp) to go to next and previous usages.
  • Click Show in Find Results go_to__show_in_find_results in the usage iteration pop-up to display all usages of the symbol in the Find Results Window, where you can analyze the usages.

This feature is inspired by and borrowed from JetBrains ReSharper, a developer productivity tool for Microsoft Visual Studio.

See Also

Last modified: 19 August 2016