如何使用键盘接受 ReSharper 命名空间导入建议?

发布于 2024-12-26 07:18:31 字数 155 浏览 2 评论 0原文

编码时,我经常从尚未使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

人间不值得 2025-01-02 07:18:31

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

菩提树下叶撕阳。 2025-01-02 07:18:31

@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:

enter image description here

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.

有深☉意 2025-01-02 07:18:31

开箱即用,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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文