Visual Studio window which shows list of methods - visual-studio

In Visual Studio, is there a window which shows list of methods in the active class? A small window like the Solution Explorer would be great. In Eclipse, there is one.

There's a drop down just above the code window:
It's called Navigation bar and contains three drop downs: first drop down contains project, second type and third members (methods).
You can use the shortcut Ctrl + F2 (move focus to the project drop down) and press Tab twice (move focus to the third drop down) to focus it, down arrow will expand the list.
Full size image

I found how to turn the drop down on as shown in the first answer (#ChrisF):
Go to Options->Text Editor->(your language)
and tick "Navigation bar" in the display section.

Since Visual Studio 2012, you can view the outline ( fields and methods) in the solution explorer by expanding the node corresponding to your file .

Shortcut to Navigation Bar is Ctrl+F2. Takes you to the types dropdown first. Press tab to go to method dropdown, and then enter on a method to go to that one.

ReSharper has a 'ReSharper | Windows | File Structure' window, which is used for visualizing current code file structure.

Resharper has the File Structure window which is very similar to eclipse outline view. Originally answered in:
Visual Studio 2012: List of all Methods in class
Resharper help:
http://www.jetbrains.com/resharper/webhelp/Reference__Windows__File_Structure_Window.html

Despite it's an old question maybe this answer help you as helped me.
you can download codemaid extension from here : codemaid website
it has a lot of functionality that you may find in their website.
the one that is related to this question is code digging
Visualize and navigate through the contents of your C# and C++ files from a tree view hierarchy. Quickly switch between different sorting methods to get a better overview. Drag and drop to reorganize the code. See McCabe complexity scores and informative tool tips.
in other words it give you ability to see the methods and properties and also reorganize them just with drag and drop. it's my everyday use extension

There is no direct equivalent to the Outline View in Eclipse. The closest thing I've found is the Class View, which lists all classes and their members/methods. There is a search box at the top to narrow the selection.

In Visual Studio 2019, there is the "Go To Member" action located in Edit - Go To that is mapped by default to ALT+\. I think this was added in Visual Studio 2017.
This is what pops up which provides the desired functionality and a couple of options:

In Visual Studio 2015, View > Other Windows > Resource View. The keyboard shortcut is Ctrl+Shift+E. I find this cleaner than Class View. With Class View Windows you can filter methods/attributes based on access modifier (private/protected/public) etc.

A nice clean way to do this is to use the command View.SynchronizeClassView by entering it into the Command Window (View > Other Windows > Command Window or Ctrl+Alt+A) but there's no way to do it automatically.
Additionally, you can:
pin your Class view window
collapse the top pane (listing all the classes)
And now it feels just like the Visual Assist's feature "List Methods in Current File" (which also list members btw).

At the top of your text editor, you should have a dropdown that lists all the methods, properties etc in the current type; and it's clickable (even if those members are defined in other files - in which case they're greyed out but you can still navigate with them).
Also, if you use the Class Explorer (Ctrl+Alt+C) to navigate your project, then you'll get a full overview of all your types. However, there doesn't appear to be a setting in Tools/Options that allows you to track the active type in that window (there is for the solution explorer) - perhaps a macro or addin is in order...

Microsoft doesn't feel like implementing this useful tool, but if by chance you can have Visual Assist, you have it in VAssistX > Tools > VA Outline. The plugin is not free though.

In Visual Studio 2005 and 2008 you can try the Source Code Outliner Power Toy.
alt text http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=SourceCodeOutliner&DownloadId=3493

Do you mean the class view window (View->Class View, or Ctrl+W,C)?
You also have the intellisence popup-window

With Visual Studio 2010
You choose Tools->Settings->Expert Settings
On the left-bottom corner, you will see the tab "Class View" right next tab "Solution Explorer"
In the top area of "Class View" layout, you will see the list of class name, enum, struct, ...
In the bottom area of "Class View layout, you will see the list of member for these class, enum or struct

I have been using USysWare DPack since forever. It is very small and not intrusive so if all you want is a quick shortcut window showing list of methods of the current file you are using, it provides just that. Good thing is that the author is still active after more than 10 years just to keep providing the same features into latest VS release.
https://marketplace.visualstudio.com/items?itemName=SergeyM.DPack-16348
After installation, just use Alt + M to bring up the method list window. I prefer to show all members instead, but it's up to you.

In VS 2012, just go to View > Class View...then you get the Class View GUI in the main tab area. Now, drag this over to the side dock and you have the exact same layout as you would in Eclipse.
-e

My best way to do this is, that i open the Code Definition Window, under View -> Code Definition Window or press Ctrl + W,D .
And then i got it floated and i have the definitions of methods in separate windows.
Regards

grep -i " sub " filename.vb > methods.txt
grep -i " function " filename.vb >> methods.txt

Related

How to list all classes implementing a interface using ReSharper?

Is there a way to list all classes implementing a given interface in ReSharper?
I usually find ",interfacename" to accomplish that but it is not a terrible solution.
In Resharper you can use Go to Implementation (Ctrl+F12, or click the symbol holding Ctrl+Alt keys) and use "Show in Find Results" option to show the results in the find results window.
Not resharper related, but Visual Studio 2015 after Update 1 allows you to right click the interface and select "Go To Implementation". With Visual Studio 2015 Update 2 they have added a shortcut Ctrl+F12.
Sure, put the text caret on the interface name and invoke Go to Derived Symbols - either Alt+End or Ctrl+Alt+B, depending on the keyboard scheme.
Note that you can also hit Alt+Enter on the interface name and type "derived" to get to the Go to Derived Symbols action a little quicker. Or use the Navigate To context menu to show all the navigation options for the interface name (Alt+~ or Ctrl+Alt+G)
Also, when the popup menu shows listing the interfaces, click the icon in the top right, and it will open the list in the Find Results window.

Find out what class a method belongs to (in Visual Studio or Resharper)

If I'm looking at a method definition in Visual Studio (with Resharper) is there an easy way to find out what class it belongs to? (As of now, I've resorted to a text search in the "up" direction for the string "class".)
The Resharper command Go to containing declaration (ctrl + [) should do the trick
Edit:
Or if you have the navigation bar at the top of the code window enabled, that should display the type name. But I have that turned off, since I use keyboard navigation and the bar itself slows down Visual Studio.
You have files with more than one class in? That makes ponies sad...
Anyway, to actually answer, can't you just look at the navigation bar?
The best (direct) way specific to your question is PHeiberg's answer.
But if you ask this question I guess you don't know the File Structure window that can be enabled by ReSharper->Windows->File Structure or by shortcut Ctrl+Alt+F.
With that window you see always where you are in your file.
Aside from using ReSharper's File Structure and/or Go to Containing Declaration - options mentioned previously - there's also a tiny feature in ReSharper called Quick Documentation that in my view is better suited for this kind of task since it shows you method info in-place, without forcing you to navigate anywhere from the method you're on. Ctrl+Q, Esc, and you're done. It works on all kinds of symbols (not limited to methods), both on declarations and on usages.
For VS, right click on the function and select 'Go To Declaration'. (Ctrl + F12)

How to show code outline in Visual Studio?

This kind of stuff exists in Eclipse:
But I've not found it in Visual Studio yet. Is there such a window to show code outline at all?
I tried both Document Outline and Class View windows. The Class View is close, but it only shows class information, can it come up with function info also?
One great plugin for VS is CodeMaid. It is powerful and it is open source!
You can also sort your methods within the CodeMaid Spade view.
Here is a screenshot.
Also non-free, but Jetbrains Resharper provides a File Structure Window, what perhaps is what you are searching for.
To display this dockable window, select from the menu: ReSharper → Windows → File Structure (default shortcut Ctrl+Alt+F
This question was asked quite a while ago and before Visual Studio Code existed but I found it when searching for how to do this with Visual Studio Code so I thought others might stumble on this question too so I thought I'd share my solution. Here's how to do it in Visual Studio Code. I'm using TypeScript but it works for JavaScript, too.
1) View -> Open View
2) select (or type) Outline
3) You'll now get an Outline palette that shows full information on the class including properties and functions.
In newer Visual Studio versions (e.g. 2015) you can see this directly in the solution explorer. Simply expand the .cs file and you will get the list of the methods in the order they are listed in the file. This is exactly the same as the Outline in Eclipse.
If you want to see the stuff alphabetically, open the file and between the tab pane and the editor, there is a row showing the project name, the class name with namespace, and a drop down with the available methods and properties.
not free, but if you install Visual AssistX, each document gets a dropdown box listing all methods in a file (alphabetically or in the order they occur)
check Class View again, it does show functions (but not per document). Also check out the Code Definition Window, extremely nice when combined with Class View.
You can use the Class View Window, or you can use outlining to collapse the code window to definitions (Ctrl-M-O and Ctrl M-L in the standard keyboard set up)
Trick is to call Ctrl+F2, then Tab, then Tab, then Down arrow. I've done it with this simple AutoHotkey script when I hit Ctrl+o:
#IfWinActive ahk_exe devenv.exe
^o::
Send ^{F2}
Send {Tab}
Send {Tab}
Send {Down}
return
#IfWinActive
It will show dropdown that is closest to Quick Outline in Eclipse or others.
There is now a free add-in available through the add-in manager in VS2010 that works quite well. It also has a dark theme.
VS10x Code Map v2
Screenshot:
Go To "Solution Explorer" and select your project; then select a class file you want to outline, then expand the little triangle just below that class (as shown in the figure below)
In VS2017 you can navigate between items in the file directly from the upper right corner of the Editor.
you can have document outline window by going to view-> Other Window -> Document Outline or you can have it using Ctrl+W, U
I am using VS-2008. You can have a look at the following links also:
http://wildermuth.com/2008/06/06/The_Document_Outline_in_Visual_Studio_2008
http://dotnetkicks.com/tipsandtricks/Visual_Studio_2008_Document_Outline_Split_View
Hope this answers your question.
// 2019 answer
There is an free extension for Visual Studio that provide code outline: https://marketplace.visualstudio.com/items?itemName=SamirBoulema.CodeNav
I've started using VSCommands 10.
This has support for the most common languages used when developing in Visual Studio 2010, including JavaScript.
There's an extension provided Free, by Microsoft, that enables this and many other features into Visual Studio. The extension is Productivity Power Tools.
Ctrl+Shift+O comes closest to what you want
If you need more, see: discussion of the Outline Feature on github
If you use PHP, make sure you install full version as mentioned in the docs
Resharper has a feature of inspection. You can see incoming and outgoing calls from there.
shortcut: CTRL+ Shift + ALT +
A list of things you can use:
1.Visual Studio default's ClassView
2.Visual Assist's VA OUTLINE Feature
3.CodeMaid's Spade Feature
In Visual Studio Code, the popup outline is not called outline but symbol list. The command is "Go to Symbol in Editor...", and default shortcut is "Ctrl + Shift + O".
Checked again, the question is to Visual Studio, I guess it could be same with Visual Studio Code.

Customizing toolbar items in VS2010

Has the menu & toolbar customization functionality in VS2010 been reduced?
I can't seem to be able to select an icon for an added command, nor set it to be icon-only. Previous versions of Visual Studio supported this functionality and even allowed the creation/editing of custom icons.
Is this something that has suffered as a result of the move to the WPF-authored UI or am I missing something?
Seems like this functionality was cut from Visual Studio 2010. This post has some info in the comments: Customizing Visual Studio 2010
Specifically - "Unfortunately assigning or editing icons to commands through Customize dialog is not possible in VS2010. It is one of the features got cut for lack of time. This is however something we'll consider adding back in next version."
The reply also has a longer explanation of a workaround.
As noted in the link mentioned in the answer from #Gordon Mackie JoanMiro, the REASON for the reduced functionality is that the VS Shell team migrated the entire UI (shell and command system) from Win32 to one based solely on WPF. This was a gargantuan task, I would imagine. However, a couple workarounds are now available:
You can export previously saved settings from VS 2008 and import them into VS 2010. That includes command bar customizations (as noted by #Don)
A more recent blog-post contains detailed instructions for using a new extension to VS2010 (available on Visual Studio Gallery) that allows users to change the images on the command UI. (Note that the old drag&drop customization interface is still not supported in this new extension.)
If you have custom icons, any attempt to make ANY changes to the tool bar will result in the custom icons disappearing and being replaced by text when you restart VS2010.
The only way I found to get my custom icons without text into VS2010 is to open VS2008, set up all of the tool bars the way I want, including custom icons, then export the settings (Tools| Import and Export Settings). Then open VS2010 and import those settings. Tedious, I know, but it allows me to have a down arrow icon that searches for the next instance of the word my cursor is on.
I have been trying to customize VS2010 toolbars/keyboard and what took a few minutes in previous versions takes hours now. The new system looks real pretty but is useless in practice. Apart from the fact you just can't do (like change the appearance of buttons as mentioned above) the things you can do are extremely time-consuming and annoying.
Why is it every new version of VS loses something really useful? Other examples:
VC++5 introduced a new HTML help system. Pressing F1 on a function name used to immediately show help for that function. After VC++5 getting context help became annoyingly much slower, and is still very slow (and inaccurate).
VS.Net (aka VS2002 or VC++7) had a useless bookmark system compared to VC++6. VS2010 bookmarks are better but not perfect.
VS.Net removed the search state buttons "whole word", "case sensitive" etc. These were possibly the most useful buttons ever as they quickly allowed you to see why a search may have failed.
I found a great extension: CommandingImage
It does not have an icon editor, but you can create your images as 16x16 png format (for transparency) and import it (I recommend Paint.Net)
Dave, here's how to add toolbar buttons:
1) in the IDE, find the down arrow looking thing on the far right of a toolbar and click on Add Remove Buttons, Customize
2) in the Customize window select the Menu Bar radio button then select the appropriate menu bar that you want to add a button to
3) click the "Add Command..." button
4) select the appropriate Category and Command button that you want to add, then click OK.
The command button you selected will be added to the menu bar you selected. You can move the button up or down.
I think this is what you are looking for.
Good luck!

Is there a hotkey in Visual Studio to open the member drop down list?

In Visual Studio there is a drop down list in the top right hand corner that you can use to navigate to the various members in the class. Does anyone know if there is a hot key to open this ddl?
I think you're looking for Ctrl + F2, which moves the cursor to the navigation bar at the top of a code view. From there, you can press Tab to move the cursor over to the member list.
For this (and pretty much every other Visual Studio hotkey/shortcut key combination), see here.
Visual Studio 2017+: They now support Resharper-like shortcuts. They work pretty well, too.
Ctrl+T - 'Go to All' (class/member/file), type m MyProp for members only
Alt+\ - 'Go to Member in current file'
Using VS 2008, I still don't know how to get directly to the Members dropdown which is what I want. But, the key bindings will be different for everyone. The command you want to search for under Options > Keyboard > Show commands containing: is Window.MoveToNavigationBar.
Assuming you are using the default keybindings packaged with Visual Studio, CTRL+F2 will focus the top-right drop-down list, and you can then navigate members by pressing TAB and using the arrow keys.
In my install of VS 2013, this is called Window.MoveToNaviationBar and is bound to Ctrl+F8. This is visual C++ settings.
Use Ctrl + F2 to get up there, then a click on Tab will get you to the member list instead of the object list.

Resources