This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How do you quickly find the implementation(s) of an interface’s method?
I like ReSharper's Go To Implementation feature but I often keep ReSharper disabled. Is there an equivalent extension for Visual Studio 2010?
I'm looking for the extension for this little "go to implementation" too. But unfortunately I couldn't find any. May be we will have to wait next version of visual studio or enable ReSharper back (which in my opinion, eating too much resources)
Well the best solution for me right now is to use "Call Hierarchy" feature of VS2010. Just follow my instruction below
Move cursor to the target method name
Press "Ctrl K, Ctrl T" (this will pop up "Call Hierarchy Window")
Press "Down", "Down", "Right", "Down", "Enter" (this will go to your implementation method)
Look funny but it is actually the way to use keyboard to navigate to the item you want
[More Explanation]
"Down", "Down" --> go to "Implements 'xxx'"
"Right" --> expand children
"Down" --> focus on the implementation method
"Enter" --> navigate to it
Hope this help
Ctrl + F12 - Go To Declaration
For me, the easiest and free way to get "Go to implementation" functionality in VS2010 (and for VS2008 for that matter) was to
Install free CodeRush Xpress
http://msdn.microsoft.com/en-us/vstudio/ee663901
Install "Go to implementator" Code Rush extension by Miha Markic. The author just today, updated his extension to work with most recent CodeRush Xpress 11.2.11
http://blog.rthand.com/page/Go-To-Implementator.aspx
Works very nicely.
Short answer, no.
You should aim to keep Resharper enabled 100% of the time, in my opinion. Ensure Solution wide analysis is turned off, use the latest resharper (Resharper 6 is out now) and/or upgrade your PC.
I'm honestly not overly familiar with Resharper but if the "Go To implementation" you are talking about is when you can click on a method call and it will take you to that method's code then I would suggest the "Productivity Power Tools" created by Microsoft.
private void foo()
{
// does stuff
}
private void main()
{
// hold down CTRL, foo() below will turn into
// a hyperlink that you can click on
foo();
}
Here's the link http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/
This will allow you to hold down the CTRL key which turns methods and variables into hyperlinks which when clicked will take you to where these were defined originally.
These Tools also can clean up unused Imports/using statements at the top of you code-behind/class files. And my favorite auto bracket completing
Not a keyboard shortcut, however Go To Definition by Noah Richards is a useful, lightweight extension to Visual Studio.
Related
After doing some Java I fell in love with some of IntelliJ's features. Especially the keyboard shortcut SHIFT +SHIFT which lets you jump to any other file.
This is a huge time savesaver. Now that I'm back in VS I really miss that feature when I'm editing code. Is there any way to reproduce this in Visual Studio? Perhaps a plugin of some sort?
It's became possible after the recently VS Code release(1.54.0 or above), you can update keybindings.json with following code:
[
{
"key": "shift shift",
"command": "workbench.action.quickOpen"
},
{
"key": "alt alt",
"command": "workbench.action.quickOpen"
},
{
"key": "ctrl ctrl",
"command": "workbench.action.showCommands"
}
]
Source: https://github.com/microsoft/vscode/issues/5280#issuecomment-767869212
Or install VS Code extension: shift shift
No need for ReSharper since Visual Studio 17 has already implemented a similar feature:
CTRL + T
Not exactly the same (doesn't show the last used/opened tabs), but works to jump to a file (might be VS 2013+ only):
CTRL+, then type your search terms, you can use space for different parts of the file name:
con na ex => ControlNameExplorer
I find it easier to use when disabling the Preview Tab (click on the down arrow at the right of the search box to change settings).
More details here.
EDIT
This shortcut is set when installing ReSharper, but you can manually set it to the command Edit.NavigateTo (Tools > Options > Environment > Keyboard).
EDIT for VS2017
The command is now named Edit.GoToAll. Thanks to Matt for pointing it out.
A few years later and ReSharper now has this feature in the latest version.
It's called Search Everywhere/Go to Type and is triggered with shortcut CTRL + N
https://www.jetbrains.com/help/resharper/Navigation_and_Search__Go_to_Type.html
Extremely useful feature, saves you lots of time and allows you to jump to other files while editing code. Once you try it, using Solution Explorer feels like a waste of time. I got used to it while using IntelliJ IDEA & Android Studio, glad it's now available in Visual Studio via ReSharper.
Not really sure what SHIFT-SHIFT does, does that mean holding down both SHIFT keys and pressing J?
I find I seldom need to goto a file. I put my cursor on a variable or a function, hit F12 and it goes to wherever it is defined, without me needing to remember it. If I press SHIFT-F12 it gives a list of every where it is referenced, again without needing to remember. If I want to go back to where I was at I press CTRL+- (which works in any context). I am quite comfortable with this navigation, and so like you, every time I try something new the first thing I do is try to find out how they implement what I am already used to.
I love the Productivity Power Tools extension for visual studio, however it has added the Ctrl+Click "Go To Definition" functionality, which is great and all, but my workflow makes me use the functionality when I don't want it.
When I want to copy something, I start marking some text, still holding down the mouse button, hold down Ctrl + C and then release the mouse button. The tool acknowledges this as a Go To Definition click, and I usually end up in the definition of String or whatever. I know I could just release the Ctrl button prior to the mouse-button; however, I have a hard time reconditioning myself from a habit I have had since forever.
Is there a way to remap the Ctrl + Click Go To Definition functionality, say, to Ctrl+Shift+Click? I know I can deactivate it by going to "Tools>Options>Productivity Power Tools>All Extensions"; however, I don't want to lose the functionality just make it work as I want it.
Edits:
This might be a ReSharper issue.
This post discusses something similar
Try going to ReSharper | Options -> Environment | Search & Navigation and turning off Go to declaration on <Control + Left click> in editor.
I don't have ReSharper. But I was able to turn this off in Visual Studio 2012. I found it in Tools - Options - Productivity Power Tools - Ctrl+Click Go To Definition.
Try menu Tools → Options → Productivity Power Tools (left menu) → Turn it off where it says Ctrl + Click Go To Definition on your right side.
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.
After working for a few days with Eclipse Java I totally got addicted to pressing Ctrl and clicking on an identifier to go to its definition. Since then I've been looking for a way to achieve this in Visual Studio as well.
I realize VS has right click, Go to definition, and that F12 does the same. I also realize that Visual Assist does something similar with Alt + G. Yet none of these are as perfect as Ctrl + click.
I've actually tried my luck for a few hours trying to write a VS plugin to do it but didn't get anywhere in the time frame I thought reasonable for this.
Does anyone know how this could be achieved? A ready plugin? A macro of some kind?
If you use Visual Studio 2010, you can use the free
Visual Studio 2010 Productivity Power Tools from Microsoft to achieve this.
I use visual studio 2013 and 2015, I installed Go To Definition. To install this extension navigate on TOOLS -> Extensions and Updates.
I'll answer the commentors who asked about the difference between Ctrl-click and F12.
Ctrl-click workflow:
Move hand to mouse
Move mouse to hover over variable name
Other hand holds down Ctrl key while you click
Move mouse to position cursor, highlight, right-click, or whatever
Move hand back to keyboard to continue typing
F12 workflow
Move hand to mouse
Mouse mouse to hover over variable name
Move hand back to keyboard
Hit F12 key
Move hand back to mouse
Move mouse to position cursor, highlight, right-click, or whatever
Move hand back to keyboard to continue typing
If you assume the cursor is already positioned on the desired variable, F12 is better. However, that's rarely the case. Also, if you stop after this specific action, assuming you want hands back at the keyboard, the cost is the same. But if you keep in mind that you probably had a reason for wanting to go to the definition, the Ctrl-click workflow saves you an instance of moving between the keyboard and mouse.
Visual Assist supports Ctrl+Click as of June 2009 (build 1727). Activate Ctrl+LeftClick in VA Options | Advanced | General. (See the comment below.)
If you have Visual Studio 2010 you can use "Go To Definition" by Noah Richards.
http://visualstudiogallery.msdn.microsoft.com/en-us/4b286b9c-4dd5-416b-b143-e31d36dc622b
oh man, just install resharper!! (vs plugin) with it installed you just go and Ctrl + click to go to definition.
this is not the only thing resharper does, try it out free!!!
I use the built in options (F12, Right-click -> Go to definition) but I know a lot of the guys at my company use Resharper and it definitely has this functionality.
Microsoft released a Visual Studio 2010 extension named "Productivity Power Tools" which now adds Ctrl+Click functionality. So if you're like me, and hate installing third-party addons, you can now have the same functionality!
Another option with VS (besides F12 and right-click > Go to Def) is add the code definition pane (View > Code Def Window). This is essentially another editing pane that shows the code for the current symbol - no need to Ctrl-click or anything. I keep it pinned to my secondary monitor. Any time I need to see the implementation for a symbol I just click it and look over.
Another nice thing about F12 is you can also do ShiftF12 to find references to a symbol and F8 through them. The two go together like love and happiness.
I prefer to bind Go To Definition to CtrlD. This makes it extremely easy to use either with both hands on the keyboard (CtrlD to go tho the definition of the symbol under the cursor) or one hand on the keyboard and one hand on the mouse (Click on a symbol, then CtrlD).
All in all, both VS and Eclipse have weird key shortcuts.
I just had to respond, too: F12 is far too right on the keyboard and you have to leave the the mouse right hand for the keyboard to use it. As a long time VS user I just didn't find it until I searched for the Ctrl+Mouse equivalent in Eclipse. It's completely borked. OK? No need to argue. (The same goes for F3 in Eclipse going for definition. ???? Why the face??? It's FIND NEXT for Pete's sake. But this can be removed after mastering the Eclipse keyboard shortcut system in the course of a few years.)
Anyway, as has been said here before, Microsoft has already understood this can be an issue for new programmers coming in from Eclipse, so they provided the Power Tools (I followed the link up above).
http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/
If you are using Visual Studio 2017, you can use Productivity Power Tools 2017
I don't work in VS much, so I haven't used it, but I've heard incredibly good things about Resharper from everyone I know who does. Everyone has told me it's worth every penny, and significantly improves efficiency in Visual Studio. I think it has a feature like what you're looking for, along with a TON of others.
What is the keyboard-shortcut that expands the menu, from the little red line, and offers the option to have the necessary using statement appended to the top of the file?
Ctrl + . shows the menu. I find this easier to type than the alternative, Alt + Shift + F10.
This can be re-bound to something more familiar by going to Tools > Options > Environment > Keyboard > Visual C# > View.QuickActions
Alt + Shift + F10 will show the menu associated with the smart tag.
I can highly recommend checking out the Visual Studio plugin ReSharper. It has a QuickFix feature that does the same (and a lot more).
But ReSharper doesn't require the cursor to be located on the actual code that requires a new namespace. Say, you copy/paste some code into the source file, and just a few clicks of Alt + Enter, and all the required usings are included.
Oh, and it also makes sure that the required assembly reference is added to your project. Say for example, you create a new project containing NUnit unit tests. The first class you write, you add the [TestFixture] attribute. If you already have one project in your solution that references the NUnit DLL file, then ReSharper is able to see that the TestFixtureAttribute comes from that DLL file, so it will automatically add that assembly reference to your new project.
And it also adds required namespaces for extension methods. At least the ReSharper version 5 beta does. I'm pretty sure that Visual Studio's built-in resolve function doesn't do that.
On the down side, it's a commercial product, so you have to pay for it. But if you work with software commercially, the gained productivity (the plug in does a lot of other cool stuff) outweighs the price tag.
Yes, I'm a fan ;)
In Visual Studio 2010 you will find the keyboard command to resolve namespaces in a command called View.ShowSmartTag. Mine was also mapped to Shift + Alt + F10 which is a lot of hassle - so I usually remap that promptly.
On Pete commenting on ReSharper - yes, for anyone with the budget, ReSharper makes life an absolute pleasure. The fact that it is intelligent enough to resolve dependencies outside the current references, and add them both as usings and references will not only save you countless hours, but also make you forget where all framework classes reside ;-) That is how easy it makes development life... Then we have not even started on ReSharper refactorings yet.
DevExpress' CodeRush offers no assistance on this regard; or nothing that is obvious to me - and DevExpress under non-expert mode is quite forthcoming in what it wants to do for you :-)
Last comment - this IDE feature of resolving dependencies is so mature and refined in the Java IDE world that the bulk of the Internet samples don't even show the imports (using) any more.
This said, Microsoft now finally has something to offer on this regard, but it is also clear to me that Microsoft development (for many of us) has now come full circle - the focus went from source, to visual designers right back to focus being on source again - meaning that the time you spend in a source code view / whether it is C#, VB or XAML is on the up and the amount of dragging and dropping onto 'forms' is on the down. With this basic assumption, it is simple to say that Microsoft should start concentrating on making the editor smarter, keyboard shortcuts easier, and code/error checking and evaluation better - the days of a dumb editor leaving you to google a class to find out in which library it resides are gone (or should be in any case) for most of us.
Context Menu key (one one with the
menu on it, next to the right
Windows key)
Then choose "Resolve"
from the menu. That can be done by
pressing "s".
It's ctrl + . when, for example, you try to type List you need to type < at the end and press ctrl + . for it to work.