在 Eclipse 中可能发生在 IntelliJ 中不可能的事情?

2022-01-20 00:00:00 ide intellij-idea java eclipse

我听过一些人发誓.两者都是功能齐全的优秀 IDE.但每个人的优势都略有不同.这并不意味着变成一场神圣的 IDE 战争.请对任何火焰诱饵答案投反对票.谢谢.

I have heard from people who swear by one or the other. Both are full-featured, excellent IDEs. But each has slightly different strengths. This is not meant to turn into a holy IDE war. Please downvote any flamebait answers. Thanks.

这是这个问题的类比.

推荐答案

我在 IDEA 中最喜欢的小烦恼(也是 Eclipse 中最喜欢的小功能)是键入左大括号时字符的定位(例如{")或一个分号.您必须在 Eclipse 中启用它(Window/Preferences/Java/Editor/Typing:自动在正确的位置插入:分号,大括号")

My favourite small annoyance in IDEA (and favourite small feature in Eclipse) is the positioning of the character when typing an opening curly brace (e.g. "{") or a semicolon. You'll have to enable it in Eclipse (Window/Preferences/Java/Editor/Typing: "Automatically insert at correct position: Semicolon, Braces")

这样只需提前输入(|"是插入符号的位置)

With this just type ahead ("|" is the caret position)

while(|

结果(还没有魔法)

while(|)

现在输入 true{,结果是

while(true) {|

如此简单,却如此强大.

So simple, yet so powerful.

另外,在(例如)

System.out.println("Hello world")

在该行中使用插入符号anywhere,键入分号将自动在行尾键入它.退格更正,就像您最喜欢的文字处理器中通常的自动更正一样.

with the caret anywhere in that line, typing a semicolon will automagically type it at the end of the line. Backspace corrects, just like the usual autocorrection in your favourite wordprocessor.

无价.在第一次尝试时,我物理上不再能够在正确的位置键入分号 :)

Priceless. I'm physically no longer able to type a semicolon at the correct position on first try :)

相关文章