Visual Studio 11 Developer Preview: Visual Basic (VB) Call Hierarchy
By Zain Naboulsi (Blog)
Default: CTRL + ALT + K
Menu: View | Call Hierarchy
Command: View.CallHierarchy; EditorContextMenus.CodeWindow.ViewCallHierarchy
Versions: Visual Studio 11 Developer Preview
With the announcement of the Visual Studio 11 Developer Preview it’s time to take a look at some of the features you can start using with our latest version of the IDE right away. If you are already familiar with the C++/C# Call Hierarchy feature from my previous blog post then you are already familiar with the features and may just want to start playing with this on your own. For those not familiar, I’ll repeat the content here. And now on with the tip…
(queue choir music)
Visual Basic developers everywhere rejoice!
The Call Hierarchy is now available for VB!
This feature allows you to visually inspect the calls to and from any selected method, property, or constructor. Simply right-click any method, property, or constructor name and select View Call Hierarchy:
This will bring up the Call Hierarchy window:
Note the Calls To and Calls From areas? You can expand them to see a list under each node if applicable:
If you select an item under one of these areas then you will get a list of Call Sites that show where the calls are happening:
You can double-click any call site to go to the line of calling code:
Instead of doing a double-click you can also right-click the call site and choose Go To Reference or you can copy the name and location of the call site as you see it listed:
You can also right-click any items in the tree-view to get a list of possible actions:
Here is a table of the actions you may come across and what they can do for you:
Context Menu Item
Add As New Root
Adds the selected node to the tree view pane as a new root node.
Removes the selected root node from the tree view pane. This option is available only from a root node.
You can also use the Remove Root toolbar button to remove the selected root node.
Go To Definition
Runs the Go To Definition command on the selected node. This navigates to the original definition for a method call or variable definition.
You can also press F12 to run the Go To Definition command on the selected node.
Find All References
Runs the Find All References command on the selected node. This finds all the lines of code in your project that reference a class or member.
You can also use SHIFT+F12 to run the Find All References command on the selected node.
Copies the contents of the selected node (but not its subnodes).
Collapses the selected node so that re-expanding it displays current information.
So, just as with C++ and C#, we now have the Call Hierarchy feature available for VB developers. This is all part of our master plan to get all languages on parity with each other so that most features are available regardless of the language used. Enjoy!