How to accept the suggestion to import a ReSharper namespace using my keyboard?

When coding, I often print an ad with a type name from a namespace that has not yet been imported using the using statement. ReShaper then displays a small hint suggesting a namespace for which using is automatically added. However, I always need to refuse input and use my mouse to accept this. How to do this using only the keyboard?

+6
source share
3 answers

Alt + Enter while the carriage is on the type you are trying to use. But it depends on the pattern you are linking to, or if the short cut was configured.

Here are the shortcuts for Visual Studio and IDEA: http://www.jetbrains.com/resharper/webhelp/Reference__Keyboard_Shortcuts.html

Here is also a good PDF printout for Visual Studio (6.0) schema http://www.jetbrains.com/resharper/docs/ReSharper60DefaultKeymap_VS_scheme.pdf

+6
source

@Bronumski's answer answers your direct question, but you don’t need to enter a class name, instead for a type that requires an import statement, you must partially enter the class name and then use Shift-Alt-Space: consider this example:

enter image description here

Suppose you want to import StreamReader - you enter the first few characters, press Shift + Alt + Space , then press Enter, and the class name and import will be added for you.

+5
source

Out of the box, Alt + Enter

To configure it yourself or see what you have, go to Tools> Options> Environment> Keyboard, enter "ReSharper_QuickFix" in the "Show commands containing" text box, and select the shortcut there.

+4
source

Source: https://habr.com/ru/post/905714/


All Articles