如何使用键盘接受 ReSharper 命名空间导入建议?
编码时,我经常从尚未使用 using
语句导入的命名空间中键入带有类型名称的声明。然后,ReShaper 会弹出一个小工具提示,建议自动添加 using
的命名空间。然而,我总是不得不放弃打字并使用鼠标来接受这一点。如何仅使用键盘来执行此操作?
When coding, I often type a declaration with a type name from a namespace not yet imported with a using
statement. ReShaper then pops up a little tooltip suggesting a namespace for which to automatically add a using
. However, I always have to leave off typing and use my mouse to accept this. How can I do this using only the keyboard?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Alt + Enter,同时插入符位于您要使用的类型上。但这确实取决于您要使用的模式或者快捷方式是否已自定义。
以下是 Visual Studio 和 IDEA 的快捷键:
http://www.jetbrains.com/resharper/webhelp/Reference__Keyboard_Shortcuts.html
这也是 Visual Studio 模式 (6.0) 的一个很好的 pdf 打印输出
http://www.jetbrains.com/resharper/docs/ReSharper60DefaultKeymap_VS_scheme.pdf
Alt + Enter whilst the caret is on the type you are trying to use. But it does depend on the schema you are tying to use or if the short cut has been customized.
Here are the short cut keys for Visual Studio and IDEA:
http://www.jetbrains.com/resharper/webhelp/Reference__Keyboard_Shortcuts.html
Here is also a nice pdf print out for the Visual Studio schema (6.0)
http://www.jetbrains.com/resharper/docs/ReSharper60DefaultKeymap_VS_scheme.pdf
@Bronumski 的答案回答了您的直接问题,但您不需要键入类名称,相反,对于需要 import 语句的类型,您应该部分键入类名称,然后使用 Shift-Alt-Space:考虑这个例子:
假设您要导入
StreamReader
- 您键入第一个几个字符,按Shift+Alt+Space 然后按 Enter 键,将为您添加类名和导入。The answer by @Bronumski answers your direct question but you dont need to type the class name, instead for a type that requires an import statement you should partially type the class name then use Shift-Alt-Space: consider this example:
Suppose you want to import
StreamReader
- you type the first few characters, press Shift+Alt+Space then press Enter and the class name and the import will be added for you.开箱即用,Alt+Enter
要自行设置,或查看当前设置的内容,请转至
工具>选项>环境>通过键盘在“显示包含的命令”文本字段中输入“ReSharper_QuickFix”,然后从那里选择一个快捷方式。
Out of the box, Alt+Enter
To set it yourself, or see what you currently have it set to, go to
Tools > Options > Environment > Keyboard, enter "ReSharper_QuickFix" in the textfield "Show commands containing", and select a shortcut from there.