Look at Peek Definition Window in Visual Studio 2013


In this article, we will look into a new feature of Visual Studio 2013 that helps to edit and view code present in various files without switching among the windows. This will help us to write code faster without jumping from the code that you're writing. Let's create a sample Console Application in Visual Studio 2013 and explore it further with the following piece of code:

Console Application in VS 2013

We are calling two methods from the Main method. "MethodA()" is present in the "Program.cs" file and "MethodB()" is in the "TestPeek.cs" file. Prior to Visual Studio 2013, we use "Go to Definition" for editing "MethodB()" that will take us away from the code that you're writing to a new window. In Visual Studio 2013, we can edit the code in the same place without switching to a new window by pressing the "Alt + F12" shortcut or clicking on "Peek Definition" as shown below:

Peek Definition

This will show the definition of MethodB() in the same window for editing as shown below:

MethodB in same window

Once we are done with editing, we can save and press the "Esc" button to close the Peek Definition window. We can press onPressOn to open the file having the definition of "MethodB()" in a new document window.

We can even nest Peek Definition windows as shown below:

nest Peek.jpg

Here, we opened "MethodA()" in a Peek Definition window, that opened "MethodB()" in another window and can navigate backward and forward using breadcrumb dots within the window.

breadcrumb dots

This feature can also be used on classes as well to edit within the current window as shown below:

Output

The keyboard shortcuts for this feature:

  • Open Definition window: Alt+F12
  • Close the window: Esc
  • Navigate among definition windows: Ctrl+Alt+- and Ctrl+Alt+=
  • Toggle between the code editor window and the definition window: Shift+Esc


We can use this feature to edit a class or method in the current editor without switching from the code that you're writing.

Comments (4)
  1. Anonymous says:

    Pingback from Visual Studio 2013 Resources | R4

  2. Anonymous says:

    Pingback from Visual Studio 2013 Resources | R4

  3. Anonymous says:

    Pingback from Visual Studio 2013 Resources | R4

  4. Anonymous says:

    Pingback from Visual Studio 2013 Resources | R4

Comments are closed.

Skip to main content