How to add shortcut for create unit test method - visual-studio

The environment is Visual Studio Community 2022, now I can add test by right click the method and select the Create Unit Tests
But there is no shortcut for it is possiable to set shortcut for this?

In Visual Studio Community 2022,select Tools > Options > Environment > Keyboard, search EditorContextMenus.CodeWindow.CreateUnitTests then set shortcut and assign (for me I use Ctrl+T, Ctrl+T)
After that you will get it like below

Related

Same shortcut in Visual Studio and Visual Studio Code

Is there a way to setup up the same shortcuts in both Visual Studio Code and Visual Studio (without having to change them all manually each time)?
I for example use Alt+Shift+A in Visual Studio Code quite frequently. But the same shortcut in Visual Studio opens a "Add Existing Item" explorer.
I found out this, but it doesn't change the shortcut as I was expecting:
How to add the same Visual Studio Code shortcut to Visual Studio ?
You can change binding with this configuration and add more key binding
Go to File->Preferences->Keyboard Shortcut
This will open two files beside each other like in the screenshot below:
Now, on the window on the right i.e. the keybindings.json file, you can define your own shortcut in the below format:
// Place your key bindings in this file to overwrite the defaults [
{
"key": "ctrl+k ctrl+d", "command":"editor.action.format" } ]
Option A: The Microsoft-provided "Visual Studio Keymap" extension for VS Code at https://marketplace.visualstudio.com/items?itemName=ms-vscode.vs-keybindings (I don't know if it has the specific mapping(s) you want)
Option B: The "Visual Studio Code" keyboard mapping scheme within Visual Studio's keyboard options (but you said that one didn't have the specific mapping(s) you want)
Option C: Manually edit the key bindings, which can then sync in VS Code and/or Visual Studio with the built-in https://code.visualstudio.com/docs/editor/settings-sync
/ https://learn.microsoft.com/en-us/visualstudio/ide/synchronized-settings-in-visual-studio but I can understand if manual edits aren't preferred.

Visual Studio shortcut for opening command prompt in current project path

On a keyboard shortcut, I want to be able to start the Windows command prompt with the working directory set to the current project directory selected in solution explorer (or text editor). Unfortunately, I am unable to find an appropriate keyboard shortcut in the Visual Studio settings.
Is such a thing possible inside Visual Studio and Visual Studio Code? And if so, how can I set it up?
Sure this is possible!
Configure an external tool
You have to set up a custom external tool. For that, go to Tools > External Tools... and click Add and configure the tool like this:
Setup the keyboard shortcut
Next, you want to bind a shortcut to that external tool. For that go to Tools > Options > Environment > Keyboard and bind your desired shortcut to Tools.ExternalCommand1. Make sure you have moved the external tool to the first position in the window shown above.
Additional Information (For Visual Studio Code)
To Open New Command Prompt use Ctrl+Shift+C to perform same action
named workbench.action.terminal.openNativeConsole

Shortcut for extract local variable in Visual Studio or ReSharper (for C#)

Is there a shortcut for extracting local variable in VS or ReSharper? I know that there are shortcut for extracting field variable but I cannot find for extracting local variable.
Thanks in advance.
Right-clicking a local variable, I get this context menu:
Assuming you want shortcuts for the highlighted commands, you can define your own shortcuts through the Visual Studio keyboard mapper. (Tools -> Options -> Environment -> Keyboard)
Introduce Variable... = "ReSharper.ReSharper_IntroVariable"
Introduce Field... = "ReSharper.ReSharper_IntroduceField"
Introduce Parameter... = "ReSharper.ReSharper_IntroParameter"
FYI My keyboard shortcuts were set by ReSharper via ReSharper -> Options -> Keyboard & Menus and applying the "Visual Studio" scheme.
(Using Visual Studio Community 2015 and ReSharper Ultimate 2015.2)

How can I export Visual Studio shortkeys (Keymap) to IntelliJ IDEA

It's a long time that I use VS and I have fully customized its environment. Now I have to use IntelliJ. It's completely unfamiliar for me. I want to export VS short keys to IntelliJ. Is there any way to do that? I'd appreciate if someone can help me.
I use Visual Studio 2015 Ultimate and IntelliJ IDEA 15 Ultimate.
I use Resharper in Visual Studio. Does it help?
You can go to File | Settings, select the Keymap item in the left part of the dialog, and select "Visual Studio" in the Keymap combo box. This should give you keyboard shortcuts in IntelliJ IDEA that are similar to the default settings in Visual Studio.
To the right of the Keymap combo box, there is a small gears button that allows you to duplicate a keymap. After duplication, you can change keyboard shortcuts for almost every action and even add more shortcuts than what you get by default. This way, you can even add (most of) your personal customizations from Visual Studio to IntelliJ.
File > Settings > Keymap select Visual Studio from dropdown
For now, just install vscode keymap from plugin store:
And there is a VSCode keymap, many thanks to the uploder!

Change keymap in Resharper?

I've applied the default (IntellJ IDEA) keymap to the Visual Studion and want to change some mapping to my custom, for example Generate Code (Alt+Ins) . How can I to do it or it is impossible .
P.S.Visual Studio 2010, Resharper 6.1
Go to Tools -> Options -> Environment -> Keyboard and find the relevant ReSharper shortcut in the list (I think the one you mentioned is called ReSharper.ReSharper_Generate).
Put your cursor in the Press shortcut keys box, press then shortcut combination you want to use for it, and then press the Assign button. You should now be able to use your new shortcut to access the command you chose.
Menu - ReSharper > Options... > Environment > Visual Studio Integration > Kayboard Shortcuts - you can choose VS

Resources