简体   繁体   English

使用 IntelliJ IDE 自动完成行并放置分号

[英]Using IntelliJ IDE to autocomplete line and place semi-colon

In eclipse you can hit "enter" and the IDE will automatically take you to the end of the line and place a semicolon.在 Eclipse 中,您可以点击“输入”,IDE 会自动将您带到行尾并放置一个分号。

In IntelliJ, if you hit shift-enter you get similar behavior minus adding the semicolon.在 IntelliJ 中,如果你按下 shift-enter,你会得到类似的行为,减去添加分号。 I have read and tried cntrl-shift-enter and you get the exact same behavior.我已经阅读并尝试了 cntrl-shift-enter 并且您得到了完全相同的行为。 However, that is such an awkward key combination to be using all the time, at least much more so than the one-button approach using Eclipse.然而,一直使用这种组合键实在是太笨拙了,至少比使用 Eclipse 的一键式方法要好得多。

Any ideas?有任何想法吗?

IntelliJ autocomplete escape IntelliJ 自动完成转义

In InteiJ IDEA use (Ctrl-Shift-Enter) for "Smart Autocomplete".在 InteiJ IDEA 中,将 (Ctrl-Shift-Enter) 用于“智能自动完成”。

It will end the line "smartly" with a semicolon as you wish.它会根据您的意愿以分号“巧妙地”结束该行。 It also works in a few different situations like IF statements of FOR loops.它也适用于几种不同的情况,例如 FOR 循环的 IF 语句。

Why don't you redo the key binding?你为什么不重做键绑定?

Go to: (spanner icon) Settings -> Keymap -> Complete Current Statement and rebind how you will (for example, ctrl-enter might suit you better).转到:(扳手图标)设置 -> 键盘映射 -> 完成当前语句并重新绑定您的方式(例如,ctrl-enter 可能更适合您)。

Or there's also a default keymap set for Eclipse that you can choose.或者,您还可以选择为 Eclipse 设置的默认键盘映射。 I'm not sure if it affects the complete-current-line action, but you could take a look.我不确定它是否会影响完整的当前行操作,但您可以看看。

你也可以使用 ctrl+shift+space

if you want always have it just do this如果你想永远拥有它就这样做

在此处输入图片说明

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

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