IntelliJ 和 Android Studio 中 Eclipse 的 Ctrl+1

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6982159/
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-19 16:47:46  来源:igfitidea点击:

Eclipse's Ctrl+1 in IntelliJ and Android Studio

eclipseandroid-studiointellij-idea

提问by Andreas K?berle

I really like the Ctrl+1shortcut (hints for errors and mini refactorings) in Eclipse. Is there an equivalent for it in IntelliJ and Android Studio?

我真的很喜欢Eclipse 中的Ctrl+1快捷方式(错误提示和小型重构)。IntelliJ 和 Android Studio 中是否有它的等价物?

回答by CrazyCoder

Alt+Enter

Alt+Enter

回答by Rob Bygrave

Personally I don't think AltEnteris particularly correct. Ctrl1does lots of code generation like generating local variables given a method call etc.

个人认为AltEnter不是特别正确。 Ctrl1做了很多代码生成,比如在给定方法调用的情况下生成局部变量等。

CtrlAltV... generates a local variable

CtrlAltV... 生成局部变量

CtrlAltF... generate a field

CtrlAltF...生成一个字段

AltInsert... generate (drop down menu to generate all sorts)

AltInsert...生成(下拉菜单生成各种)

Now, unrelated to the question but maybe helpful and in the same ball park is that the "foreach" short cut in IntelliJ is iterrather than for.

现在,与问题无关但可能有帮助并且在同一个球场中,IntelliJ中的“ foreach”捷径是iter而不是for.

回答by zirael

I also don't think ctrl+enter is the answer.

我也不认为 ctrl+enter 是答案。

I'd say ctrl+alt+shift+t(Refactor this...) which I remapped to ctrl+1is the closest thing to ctrl+1 from eclipse. It allows you to inline, extract code (variable, method, field etc.), move code, pull members etc.

我想说ctrl+ alt+ shift+t(重构这...),我重新映射到ctrl+1是最接近从日食CTRL + 1。它允许您内联、提取代码(变量、方法、字段等)、移动代码、拉取成员等。

回答by Milad Faridnia

Ctrl+ 1was one of my favorite shortcuts but unfortunately there is no exact equivalent shortcutfor that. You can search for Quick fix in: File-->Settings-->Keymap, but you'll find nothing.

Ctrl+1是我最喜欢的快捷方式之一,但不幸的是没有完全等效的快捷方式。您可以在: 中搜索快速修复File-->Settings-->Keymap,但您将一无所获。

Although many people would say Alt+ Enteris the nearest answer. but I think there are better equivalents such as Ctrl+Alt+Shift+t. It will give you some magic options.

虽然很多人会说Alt+Enter是最接近的答案。但我认为有更好的等价物,例如Ctrl+ Alt+ Shift+ t。它会给你一些神奇的选择。

You can also remap it to Ctrl+ 1by going to:

您还可以通过以下方式将其重新映射到 Ctrl+ 1

File-->Settings-->Keymap

File-->Settings-->Keymap

enter image description here

在此处输入图片说明

回答by Madhava

Try pressing CTRL+ ALT+ v.

尝试按CTRL+ ALT+ v

It will give the return type exactly of that method.

它将准确地给出该方法的返回类型。