Do you know how can i change the hot key in VS?
Example: I want to extract function of class into interface, default VS use Ctrl + Shirt + R. I want to change to Ctrl + Shirt + I
Thanks!
The Hot Key that you have given is mapped on my Installation to Debug.RefreshWindowsapp, Loooking at the bindings there is a Refactor.ExtractInterface that on my computer is mapped to Ctrl+R,Ctrl+I. You can locate it by going to Tools --> Options --> Environment --> Keyboard, Once you get there you can edit the hotkey to your liking, you will have to change the bindings that are in conflict with what you are trying to use.
Related
I used to used the shortcut Ctrl + Shift + C to add a new class in Visual Studio 2015. This seems to have gone away when I'm using a different machine. How do I set this?
I've looked in Options > Environment > Keyboard but I can't see anything obvious...
Navigate to Tools >> Options >> Environment >> Keyboard, search for commands containing Project.AddClass and setup the shortcut you want
Steps to setup a shortcut
Search any command like AddClass in Show commands containing box
Select a desired command
Click on the blank Press shortcut keys box
Press desired key / key combination for shortcut using your keyboard
Also, see article Visual Studio Shortcuts and Add on Tools...
This article explains the same in more detail with some other interesting (and perhaps even relevant) points.
When developing for Android in Eclipse, for example, it's easy to automatically import packages and classes by hitting Ctrl+Shift+O. I'm finding it difficult to write code every time I have to go google a function to figure out its namespace ... is there an easier way?
Once you've added a dll as a reference, VS will suggest this as part of its intellisense feature. Type in the name, and then hover over it - there will be a blue (maybe it is red?) underline - and VS will give you an arrow to click that lets you add the namespace.
If it is a namespace you find yourself adding frequently, you can add it to your config so that you're not doing it in files across your project.
(I do have Resharper installed so I can't check this, but I'm pretty sure VS has this natively...)
There is Ctrl + Shift + F10 or Ctrl+ shortcut, that provides some light refactorings like creating method stubs, renames methods and variables and imports usings.
This shortcut is not always available - it can be used when a small red box underneath, after you click it you'll see the drop-down menu with a choice of possible actions
When you type in a class name, hit Ctrl + . a list would appear, then hit Enter on what you need
I'm recording some macro like: collapsing all outlining, locating opened file in solution explorer, opening the pending changes pane... But I'm having difficulty in choosing the keyboard mapping for my macros. It seems like any mapping I choose are reserved by Visual Studio IDE default setting.
What mappings are you using?
[Edit]
I found the below: Ctrl + ' Ctrl + ` You may have others.
Try Ctrl-Shift 3, Ctrl-Shift 4 etc. You can get a good stretch running there. Also, just because a key is bound by default doesn't mean you can't use it. I probably wouldn't re-use Ctrl+S but if you never use Ctrl+W for whatever it's bound to, go ahead and bind it to your macro. They're your settings. It's your copy of the program.
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.
What is the shortcut to open a file within your solution in Visual Studio 2008 (+ Resharper)?
Ctrl + T (ReSharper, Goto, type) will open a class file for you.
Looks like Ctrl + Shift + T opens files.
Depending on your keymap, Ctrl + Shift + N will open any file in the solution, or Ctrl + N will open any type.
If the standard toolbar is visible the following will open any file in the solution (resharper is not necessary).
Ctrl + D places you in the Find textbox. >of f will provide a dropdown with all files that start with f with path information after the filename to distinguish name collisions. Complete the filename, or arrow down to the correct one and hit enter to open it in the editor.
I attended a presentation recently where Kirk Jackson showed how to add aliases to the command window in Visual Studio. Bear with me, it gets better.
So it went like this:
Open Command Window and type
alias fo File.FileOpen
Now in your editor window hit Ctrl + / to put the focus into the Find box on the toolbar
If you use the prefix > this is command window (sneaky huh?) so type:
fo
and intellisense kicks in and shows you the names of the folders and files in the solution.
The alias is persistent between Visual Studio sessions.
Not exactly a keyboard shortcut but using this technique you can access any command in Visual Studio from the keyboard.
You should also check out Kirk's list of essential VS tips and tricks
It depends on the key mapping that you have set.
With default keymapping: Do Ctrl + T to open a type and Ctrl + Shift + T to open a file.
With IntelliJ like mapping : Do Ctrl + N to open a type and Ctrl + Shift + N to open a file.
Visit the following links for all your key mapping.
ReSharper 4 Default Keymap: Visual Studio scheme
http://www.jetbrains.com/resharper/docs/ReSharper40DefaultKeymap.pdf
ReSharper 4 Default Keymap: ReSharper 2.x / IDEA scheme
http://www.jetbrains.com/resharper/docs/ReSharper40DefaultKeymap2.pdf