vb.net 在 Eclipse 的 Android 开发中,Visual Studio 相当于 Ctrl + Shift + O 快捷键是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15431689/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 12:48:43  来源:igfitidea点击:

What is Visual Studio's equivalent of Ctrl + Shift + O shortcut in Android development in Eclipse?

androidvb.neteclipsekeyboard-shortcuts

提问by

I have been doing some Android development and found that Ctrl+Shift+O shortcut is quite handy for someone like me who is still getting used to what imports are necessary for different objects on the screen. I have also been doing vb.net development in Visual Studio 2008 and by mistake tried that shortcut however it tried opening a form or something similar. So my question is: is there a shortcut that lets us import all missing references or remove the unnecessary ones in Visual Studio 2008?

我一直在做一些 Android 开发,发现 Ctrl+Shift+O 快捷键对于像我这样仍然习惯于屏幕上不同对象所需的导入的人来说非常方便。我也一直在 Visual Studio 2008 中进行 vb.net 开发,并且错误地尝试了该快捷方式,但是它尝试打开一个表单或类似的东西。所以我的问题是:是否有快捷方式可以让我们导入所有缺失的引用或删除 Visual Studio 2008 中不必要的引用?

采纳答案by User 12345678

To Remove Unnecessary Import Directives

删除不必要的导入指令

I can confirm that in Visual Studio 2012 and Visual Studio 2010 there is a context menu option for the code-editor to remove, sort or remove and sort using directives in either Visual Basic.NET or C#. I've actually never used Visual Studio 2008 but a quick search reveals that it is possible in 2008 too (source).

我可以确认,在 Visual Studio 2012 和 Visual Studio 2010 中,代码编辑器有一个上下文菜单选项,可以使用 Visual Basic.NET 或 C# 中的指令进行删除、排序或删除和排序。我实际上从未使用过 Visual Studio 2008,但快速搜索显示它在 2008 中也是可能的(来源)。

..

..

In order to hook this functionality up to a hotkey all you need to do is:

为了将此功能与热键挂钩,您需要做的就是:

  1. Go to Tools > Options
  2. Expand the root node annotated 'Enviroment' and then click the node annotated 'Keyboard'
  3. Search for Edit.RemoveAndSortand assign your hotkey of choice.
  1. 转到工具 > 选项
  2. 展开注释为“环境”的根节点,然后单击注释为“键盘”的节点
  3. 搜索Edit.RemoveAndSort并指定您选择的热键。

To Add Unknown Import Directives

添加未知的导入指令

I use this plugin called ReSharperwhich presents me with an interface like this when I reference a class that does not have an appropriate import directive:

我使用这个名为ReSharper 的插件,当我引用一个没有适当导入指令的类时,它会为我提供这样的界面:

enter image description here

在此处输入图片说明

If you don't want to use ReSharper (it's pretty expensive) then Visual Studio has a slightly less productive but just as effective interface. You should see the class reference underlined in red and if you hover your mouse to the red line you should see a little dialog displaying the option to add a reference to the namespace. You can also press CTRL + .to show the dialog quickly.

如果您不想使用 ReSharper(它非常昂贵),那么 Visual Studio 的效率稍低,但同样有效。您应该会看到用红色下划线标出的类引用,如果将鼠标悬停在红线上,您应该会看到一个小对话框,其中显示了添加对命名空间的引用的选项。您也可以按CTRL + .快速显示对话框。

回答by Emil Adz

From this link:

从这个链接:

Automatic namespaces import

自动命名空间导入

Looks like Shift + ALT + F10will do the trick.

看起来Shift + ALT + F10会成功。