Visual Studio Keyboard Shortcut - visual-studio

I am new with Visual Studio and I have been looking for keyboard shortcuts but I can't find the one that would show me the doc of a function.
Sometimes it shows it automatically but for other functions don't do it and when you start writing it dissapear so you can't read it again in case you need it.
In jupiter notebook you can do that by pressing in a function CONTROL + SHIFT but there is nothing in Visual Studio and I think it's very handy when you are new.
Please, could anyone help me.
Thank you

I'm not so familiar with Python, but I believe the command you need to invoke is Edit.QuickInfo, to show docs for the symbol under the caret.
In this screenshot you can see it is set to Ctrl+K, I on my machine. It may be different on yours. If you click on Edit.QuickInfo in the list of commands, it will show you what the shortcut is for your environment.

Related

Is there a keyboard shortcut to move the cursor between methods in Visual Studio 2010?

Is there any keyboard shortcut to move the cursor between methods in Visual Studio? Is there any plugins that can do the same job?
All the time when I program, I want to go at the end of the current method and if I could have a shortcut that can move the cursor at the beginning of the next method and then just have to type a couple of up arrow to be where I want would be fantastic.
Thank you.
Note: For VS <2015, the following works only for the VB.NET code editor. In VS 2015+, apparently the C# code editor is also supported.
While there are no default keyboard bindings to jump between methods, you can set them up yourself:
Go to Tools → Customize…, then Keyboard…, and do the following:
Search for the commands by typing Method in the input line at the top.
Locate the two commands Edit.NextMethod and Edit.PreviousMethod.
For each of these, select the command first, then move the input focus to the input field Press shortcut keys, enter an unassigned key combination, and press the Assign button.
(The screenshot above shows that I have previously assigned one of these commands to Ctrl+Shift+<.)
Hi another (cheaper) alternative might be the CTRL+M+M to collapse/expand the current method to it's definition, allowing you to quickly navigate to the next.
Also CTRL+M+O to collapse all members is useful, with CTRL+M+L to expand all again.
Visual Studio doesn't have such a function, but JetBrains' ReSharper does. At least is the only one that I know of to offer this functionality.
For ReSharper the shortcuts are Alt-Up and Alt-Down, for previous/next member.
Try CTRL + ALT + UP. This first takes you to the scope selector where you can select a class if applicable, then press TAB which takes you to the method selector where you can select a method from the selected scope.
Note I use In Visual Studio 2012, don't know if works in other versions.
Jason Malinowski is right on his comment. It even says the shortcut keys are Ctrl+Down Arrow and Ctrl+Up Arrow. I used to use this all the time in VB6, but when I tried it lately using recent versions of visual studio, it didn't work; it would just scroll the edit window up or down one line.
When I went into Tools -> Options, select "Environment" on the left, and then the subcategory of "Keyboard", then type "Edit.ScrollLineDown" it said Ctrl+Down Arrow. When I removed this shortcut (and the one for ScrollLineUp), the next/previous method shortcuts then worked! I'm personally very happy about this.
Obviously, if you can find the right command, you can customize your keyboard shortcuts any way you please here.
I know this is old, but looks like it was added since.
Try Alt+[ or Alt+]
In Visual Studio 2013 with the commercial Visual Assist expansion you can use ALT+M to open a list with all methods in the current file. Select one, hit ENTER and the cursor will jump to it.
do not forget about the excellent, free DPack extension, which will add Alt+m shortcut which will open a list of all methods in the current class. You can type a search string to filter, and what is also great is if you tab down and enter on a method, and then later do Alt+m again, if you tab into the window you will be on the last method you selected. DPack also has many more features, like bookmarks, but I do find that you have to setup the hotkeys, or more exactly, re-assign hotkeys from other functions to DPack: https://marketplace.visualstudio.com/items?itemName=SergeyM.DPack-16348
Its Ctrl + } - by placing the cursot to end of line - using studio 2015
Same will also bring the cursor back to bottom.
so place the cursor at end of function and press Ctrl + }
In Visual Studio 2015:
Alt + Up or Alt + Down

Is there a keyboard shortcut to quickly find and open a file in Visual Studio 2005/2008 like how they do it in TextMate?

Is there a keyboard shortcut to quickly find and open a file in Visual Studio 2005/2008 like how they do it in TextMate?
In textmate Command + T in Textmate brings up something that you can type a few key which would display all relevant files and allow you to quickly select one, Command + T back and forth also allows you to quickly alternate between 2 files most recently used. This is extremely helpful.
I am aware that there is a Ctrl + Alt + ↓ which shows a list of all open documents which is almost there but not quite.
You can hit Ctrl+D to go to the search box, then type >of filename (with autocomplete).
You can also do this and other commands in the command window or the immediate window.
Or, if you don't mind buying, ReSharper has Go to File which I highly recommend. It's Ctrl+Shift+N and it brings up a nice search dialog that supports wildcards and other shortcuts.
Sonic File Finder is a free VS plugin which is basically the same thing, and quite well-loved by most people who install it.
http://www.jens-schaller.de/sonictools/sonicfilefinder/index.htm
I think the best solution is the following
CTRL + , (comma) then type your file/class/method name
I've made an extension that works exactly like Textmate's "go to file" feature: https://github.com/maxt3r/VS-CmdT
If you go to the search box in visual studio and type ">open " and then start typing, autocomplete will come up for all the files in your solution. This is in 2008, not so sure about 2005.
Out of the box in Visual Studio, Ctrl + Tab will toggle between the two most recent files.
Ctrl+Shift+T in Resharper works just like you describe. It provides a text box in which you type the filename and it generates a live list from which you can pick from. Nice features include wildcarding (e.g. Customer*xaml) and matching on camel case filenames (e.g. SVD will match SingleValueDecomposition.cs). At my work, if people use one feature of Resharper, it will be Ctrl+Shift+T.
If you code in C++ rather than C#, then Visual Assist provides some functionality. And in my opinion, works better than Resharper.
Sara Ford has a blog post about this: Did you know... How to open a file in the solution without using either a tool window or a dialog?
All the previous responses are accurate and are mentioned in her post and the comments. In addition, another approach is to launch the command window using CTRL+ALT+A then typing in "of filename" or "open filename" in the same way mentioned for the search field.
#Adam Neal mentioned ReSharper. Another popular tool is CodeRush/Refactor! Pro and it also has a file navigation window that can be launched (and searched) via the CTRL+ALT+F shortcut.

Visual Studio (or resharper) variable and method coloring

Ok, I am not sure what the naming for this is actually called, but I would like to know if the following is possible in Visual Studio.
When I set my cursor on or highlight a variable, or method name, or string... etc, I would like the IDE to highlight all uses of it. So if I highlight variable x, then it highlights all other uses of variable x.
This is done in eclipe and Notepad++, and I have become very fond of that feature, but when I move to VS, I cannot seem to get that functionality.
I know I can use the right click and find definition, also I can use resharper to find all uses, but that is not as easy and intuitive. I am currently using VS2008, but would like it in both 2008 and 2005.
Also, if this is a feature of resharper that I just don't see, that is good too.
Thanks
With Reshaper you can press Shift+Alt+F11 when your cursor is inside a variable to highlight all usages of that variable in that file. (Then ESC to remove the highlighting)
This is not a feature of Visual Studio 2008 or previous versions. It will be a feature of Visual Studio 2010 though.
http://blogs.msdn.com/somasegar/archive/2008/12/19/code-focused-development-in-vs-2010.aspx
With ReSharper, if you're using the IDEA keybindings, use Ctrl+Shift+F7. If you're using the VS keybindings, use Shift+Alt+F11 (like Martin Harris said).
You can find the full map of keybindings here: ReSharper Feature Map
A VS plugin that I use, WholeTomato's Visual Assist X, does this. If the thing being highlighted is a variable, it will even show assignments and reads in different colors.
DevExpress Refactor or Code Rush (I have both, so I'm not sure which) will do this.
Place the cursor on a variable and hit tab; all uses of the variable that are in scope will be highlighted.
In Visual Studio, have the variable selected(you can also select methods etc.), then in the top menu go to Resharper -> Find -> Highlight Usages in File or press Shift + Alt + F11 on the keyboard.
Then if you want you can navigate down trough the usages with Ctrl + Alt + PgDn and upwards with Ctrl + Alt + PgUp.

Eclipse's Ctrl+click in Visual Studio?

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.

F6 for compiling?

I have become accustomed to using F6 to compile the current document. A third-party install appears to have turned this function off. (F6 no longer does anything.)
Can anyone tell me how to get it back?
I'm using VS2008
Tools > Options > Keybord
This dialog lets you bind keyboard shortcuts to your heart's content. BTW this is how you bind keyboard shortcuts to custom IDE macros as well.
Thanks. The dialog: Tools > Options > Keybord
Allowed me to set the keyboard back to Visual C# 2005. So far, this seems to be what I wanted.
VMware's integrated debugging tool did this to me too. You can change this back to whatever you want, but every time you restart Visual Studio your keyboard shortcuts will be changed again.
The only way I could fix this was to remove the VMware debugging tools.
Its become a habit for me to use Ctrl + Shift + B to build my solutions. I know this doesnt answer your question, but I thought I would point it out.
Another keyboard shortcut is use constantly is Alt + Shift + F10. It opens the drop menu from the little red square under a change (the autocorrect type thing, I'm not sure what its called, also works for autocorrect in all the MS apps)

Resources