简体   繁体   English

在intellij中是否有实现接口方法的捷径?

[英]Is there a shortcut to implement interface methods in intellij?

When I type something along the line of this: 当我按以下方式键入内容时:

class Foo implements Bar{}

intellij idea highlights that line and then I have to hover over it with the mouse pointer until a red lightbulb pops up and click "Implement methods". intellij的提示突出显示了该行,然后我必须用鼠标指针悬停在该行上,直到弹出红色灯泡,然后单击“实施方法”。 Is there a keyboard shortcut for this? 有键盘快捷方式吗?

Ctrl + I / Cmd + I(Windows / Mac)是默认IntelliJ键盘映射中“实施方法”的快捷方式。

It also depends on which Keymap you are using. 它还取决于您所使用的Keymap。 For instance, I am using Jetbrains Rider on MacOS and the shortcut for implementing missing members is "Cmd+Shift+I". 例如,我在MacOS上使用Jetbrains Rider,实现缺少成员的快捷方式是“ Cmd + Shift + I”。

To be able to learn your shortcut key, go to Preferences (Cmd + ',') and select Keymap. 为了能够学习您的快捷键,请转到“首选项”(Cmd +',')并选择“键盘映射”。 You can just type 'implementation' to the search bar on the right, or Navigate to the Main menu > Code > Implement Methods. 您只需在右侧的搜索栏中输入“实施”,或导航至主菜单>代码>实施方法。 You will see the shortcut defined according to your settings. 您将看到根据您的设置定义的快捷方式。

Shortcut for Go to implementation(s) : Go to implementation(s)快捷方式:
- For Mac: Cmd + Option + B . -对于Mac: Cmd + Option + B
- For Windows: Ctrl + Alt + B -对于Windows: Ctrl + Alt + B
Reference: https://resources.jetbrains.com/storage/products/intellij-idea/docs/IntelliJIDEA_ReferenceCard.pdf 参考: https : //resources.jetbrains.com/storage/products/intellij-idea/docs/IntelliJIDEA_ReferenceCard.pdf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM