Visual Studio 2013 Preview: Peek Definition aka Go To Definition (Peek)

Traditionally when you want to view the definition of a method you place your cursor inside the call:

5-16-2012 12-26-10 PM


Then press F12 to go to the document where the definition exists:

5-16-2012 12-27-17 PM



Using Peek

But what if you don’t want to leave your current location:

5-16-2012 12-26-10 PM


No problem! Just take advantage of the new Peek Definition feature by pressing ALT+F12:

5-16-2012 12-29-03 PM


This feature will actually open a small window below the method call so you can view its definition. This makes it very easy to view a definition without losing your place in the current document.




If I want to go to another definition from here I can just place my cursor inside the item:

5-16-2012 2-25-33 PM


And press ALT+F12 again. It will update the window to show the new definition:

5-16-2012 2-27-51 PM


But something else also happens. Notice the dots showing up in the top right-hand side of the window:

5-16-2012 2-29-46 PM


The Peek window is keeping track of the definitions you have been to so you can navigate easily between them:

5-16-2012 2-31-06 PM


You can use your mouse to click any of the dots or the forward and back links. Also, as you can see, you can use CTRL+ALT+Minus(-) and CTRL+ALT+Plus(+) to move backward and forward respectively.


I’m not sure what the upper limit is on number of entries it will remember but at 18 entries the More indicators showed up to allow navigating through a higher number of definitions. I suspect the number of entries can go quite high:

5-16-2012 2-42-08 PM



The next most obvious question is: “Can I edit the code in this definition window?” Currently the answer is “no” however it is something that is being considered before we ship. Let me know your thoughts.

Comments (10)
  1. Craig says:

    How about a "Go to Implementation" option as well as "Go to Definition". In 90% of the time when using interfaces that is what the developer really wants.

  2. ptran says:

    +1 on what Craig has suggested.  That is the biggest reason why I may opt to buy Resharper.  However, I don't want to pay that hefty price.  

  3. Oran Dennison says:

    I agree, it needs Go to Implementation as well as Go to Definition.  In our code base, that's about 70% of our code navigation.  You also need to add support for editing, at least if you want to be competitive with Adobe Edge Code / Brackets.

  4. Joshua says:

    +1 for "Go to Implementation". This is one of the features I miss the most when not using ReSharper (or similar). Also the "Move this class/enum/struct to its own file" feature but that's another story.

  5. alex says:

    +1 for "Go to Implementation". With our MVP pattern we are doing a lot of work against interfaces, which means that quite often going to definition actually takes us to a method in an interface. Unfortunatelly command "Go to Definition" is completely useless for us.

  6. Hakan says:

    +1 on what Oran said which would also include adding support for frontend code (css, javascript)

  7. Oleg Tkachenko says:

    Oran, in VS 2013 RC Peek Definition is now fully editable.

  8. zainnab says:

    I can confirm what Oleg and am happy for the change. By the way, I submitted the "Go To Implementation" idea to the team that owns this feature and here is the reply:

    "On the Go To Implementation feature, you are right – it would be a super cool feature to have!  Have you heard of the Roslyn project? The C#/ VB Languages team is working on a vNext project called Roslyn which enables exactly the capabilities such as Go To Implementation. We will certainly consider adding this feature. I will pass on your feedback to the languages team."

    The Roslyn project is actually public knowledge and you can go here to find out more:…/roslyn.aspx


  9. Mike says:

    Is there a keyboard shortcut to close the navigation window (and all associated breadcrumbs)? Having a keyboard shortcut to get to something and then having to switch over to the mouse to get rid of it is a bit of a pain.

  10. Geir says:

    Mike, try pressing 'esc', works for me 🙂

Comments are closed.

Skip to main content