Show Current Function on Toolbar in Visual Studio

2019-07-21 10:02发布

问题:

I wish to show the current function my cursor is in. I sorely miss this feature from VS6, I have tried customizing the toolbars but it should be no surprise I can't find it within the maze of hundreds of toolbar items, does anyone know what it is called and where its located? Or if its possible?

Let me give you an example. I'm debugging and see a variable is set to a certain value, I need to examine where this is set, so I search for variable name, Ctrl-F, F3, F3, F3, when the cursor is moved to the next result and if its in the middle of function I need to know very quickly what function its in, scrolling or any mouse interaction is a major slowdown in this process, I use the keyboard 90% of the time during my dev.

PS: note to visual studio developers. When you toolbar item list contains over 5,000 items it might be time to make it searchable lol!

回答1:

In Visual Studio 2010, the code editor window has a toolbar at the top called the "Navigation Bar". In C++, C#, and VB the right-hand drop down in the Navigation bar is dynamically updated to reflect the current function or method that the cursor is in. You can read more about the navigation bar here:

  • How to: Navigate Code and Text