首页 > 解决方案 > Intellij Idea - 完成下一个参数快捷方式

问题描述

示例:作者 author = new Author("Jack", "Daniels"); 在 Exlipce 中,当填写“Jack”并按下“enter”时 - 它会自动转到第二个参数并让我填写第二个参数。在 Intellij 中,我总是必须用鼠标单击或使用箭头键。Intellij 中是否有使其更快的快捷方式?我自己一个也找不到。

标签: intellij-ideashortcuts

解决方案


自 IntelliJ 2018.2 起

您现在可以跳出右括号或使用 Tab 引用。

(来自:https ://blog.jetbrains.com/idea/2018/07/intellij-idea-2018-2-macbook-touch-bar-java-11-breakpoint-intentions-spring-boot-version-control-and -更多/

基本上,这意味着如果您有:

Author author = new Author("Jack<cursor>");

然后按Tab,光标会这样放置:

Author author = new Author("Jack"<cursor>);

注意:光标最初的位置无关紧要,只要您在引号内的某个位置,当您按下Tab光标时,光标就会移到外面并放在它后面。如果要输入下一个参数,则必须手动键入逗号和字符串。

该选项可以在下面找到:Settings -> Editor -> General -> Smart Keys并且被称为Jump outside closing bracket/quote with Tab

还有一些其他有用的选项,比如insert pair quoteinsert pair brackets

如果您想更高级,可以查看Live Templates


推荐阅读