在 Eclipse 中可能的事情在 IntelliJ 中不可能?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/461255/
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
Things possible in Eclipse that aren’t possible in IntelliJ?
提问by Craig P. Motlin
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.
我从那些信誓旦旦的人那里听说。两者都是功能齐全的优秀 IDE。但每个人的优势都略有不同。这并不意味着要变成一场神圣的 IDE War。请对任何火焰诱饵答案投反对票。谢谢。
This is the analog of this question.
这是这个问题的类比。
回答by Olaf Kock
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")
我在 IDEA 中最喜欢的小烦恼(以及在 Eclipse 中最喜欢的小功能)是键入左花括号(例如“{”)或分号时字符的定位。您必须在 Eclipse 中启用它(Window/Preferences/Java/Editor/Typing:“在正确位置自动插入:分号、大括号”)
With this just type ahead ("|" is the caret position)
只需提前输入(“|”是插入符号位置)
while(|
results (no magic yet) in
结果(还没有魔法)在
while(|)
now type true{, results in
现在输入true{,结果是
while(true) {|
So simple, yet so powerful.
如此简单,却如此强大。
Also, in (e.g.)
此外,在(例如)
System.out.println("Hello world")
with the caret anywherein 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.
在该行中的任何位置使用插入符号,键入分号将自动在该行的末尾键入它。Backspace 更正,就像您最喜欢的文字处理器中通常的自动更正一样。
Priceless. I'm physically no longer able to type a semicolon at the correct position on first try :)
无价。第一次尝试时,我的身体不再能够在正确的位置键入分号:)
回答by Craig P. Motlin
Eclipse's incremental compiler lets you run unit tests even while there are compiler errorsin unrelated code. IntelliJ relies on javac which doesn't emit bytecode unless all the code is valid.
即使无关代码中存在编译器错误,Eclipse 的增量编译器也允许您运行单元测试。IntelliJ 依赖 javac,除非所有代码都有效,否则它不会发出字节码。
回答by passsy
I tried to switch to IntelliJ because of the new Android Studio. But I'm very disappointed now. I'm using Eclipse with the Code RecommendersPlugin. Here is a simple example why Eclipse is so awesome:
由于新的 Android Studio,我尝试切换到 IntelliJ。但我现在非常失望。我将 Eclipse 与Code Recommenders插件一起使用。这是一个简单的例子,为什么 Eclipse 如此棒:
I want to create a new SimpleTimeZone
. SimpleTimeZone
has no Constructor with zero arguments.
我想创建一个新的SimpleTimeZone
. SimpleTimeZone
没有带零参数的构造函数。
Ctrl + Space in Eclipse
Eclipse 中的 Ctrl + 空格
Ctrl + Space in IntelliJ
IntelliJ 中的 Ctrl + 空格
In IntelliJ I get no informations what kind of constructors SimpleTimeZone
has.
在 IntelliJ 中,我没有得到任何构造函数类型的信息SimpleTimeZone
。
After Enter in Eclipse
进入Eclipse后
I get the previously selected constructor filled with predefined variable names. And I can see the type of every argument. With Code Recommenders Eclipse guesses the right constructor by the previously defined variable types in the current scope and fills the constructor with these vars.
我用预定义的变量名填充了先前选择的构造函数。我可以看到每个参数的类型。使用代码推荐器,Eclipse 会根据当前范围内先前定义的变量类型猜测正确的构造函数,并用这些变量填充构造函数。
After Enter in IntelliJ nothing happens. I get an empty constructor. I have to press Ctrl + P to see the expected arguments.
进入 IntelliJ 后什么也没有发生。我得到一个空的构造函数。我必须按 Ctrl + P 才能看到预期的参数。
or try something simple. Type
或尝试一些简单的事情。类型
syso<Ctrl+Space>
Eclipse: System.out.println()
蚀: System.out.println()
IntelliJ: syso
智能: syso
回答by SamBeran
回答by Romain Linsolas
Since Eclipse 3.3 (but it can be done before using a plugin), you can automatically execute actions while saving a Java file:
从 Eclipse 3.3(但可以在使用插件之前完成),您可以在保存 Java 文件时自动执行操作:
- organize imports
- format source code
- some other actions (like adding annotations, removing unnecessary casts...)
- 组织进口
- 格式源代码
- 其他一些操作(例如添加注释、删除不必要的强制转换...)
This can be configured in Preferences > Java > Editor > Save actions.
这可以在Preferences > Java > Editor > Save actions 中配置。
回答by Peter Severin
The open nature of Eclipse platform makes thrive the plugin writers community. There are tons of plugins available for all kind of tasks.
Eclipse 平台的开放性使插件编写者社区蓬勃发展。有大量插件可用于各种任务。
回答by Peter Severin
My favorite Eclipse features:
我最喜欢的 Eclipse 功能:
- AspectJ integration that includes navigation between aspects and the code, annotation markers showing where aspects are applied, cross reference view, common open typed dialog showing aspect types (recently added)
- OSGi tooling (aka PDE), editing and optimizing OSGI manifest, refactorings specific to OSGi and declarative services editor (currently in the works)
- AspectJ 集成,包括方面和代码之间的导航、显示方面应用位置的注释标记、交叉引用视图、显示方面类型的常见打开类型对话框(最近添加)
- OSGi 工具(又名 PDE)、编辑和优化 OSGI 清单、特定于 OSGi 的重构和声明式服务编辑器(目前正在开发中)
回答by ftravers
I can't figure out how to automatically add javadoc in Intellij, whereas in Eclipse it's just: Shift-Alt-j
我不知道如何在 Intellij 中自动添加 javadoc,而在 Eclipse 中它只是:Shift-Alt-j
Things I don't like about IntelliJ (from an Eclipse developer)
我不喜欢 IntelliJ 的地方(来自 Eclipse 开发人员)
Tab key doesn't indent to correct spot with just one tab press.
The multi project is the first one...but many people have covered that before so I'll leave it.
The splitting of windows. In Eclipse you simply drag the window wherever you want it and it goes there.
The font sucks. I changed to the next best one i could find: Liberation Mono, size 14. (Setting>Editor>Colors&Font>Font)
Highlighting for XML is nasty...removed the bolds.
Syncing the editor window with the file selected in the project navigator. I can't make this happen by default, I have to press the button each time??? Found it:
Double clicking in project navigator sometimes doesn't open the file. Sometimes even tripple clicking won't do it. Only a quadruple click opens it up! ** Here is an answer...it's just that the double click speed is too freakin fast: In regards to the double clicking in IDEA the reason why it's hard to open files by double clicking is that Java programs e.g. IDEA reads the double click speed from X11 resources. If it is not explicitly set then it defaults to 200 ms which is lightning fast. In order to have a more sane threshold create ~/.Xresources and add: *.multiClickSpeed: 400
Can't figure out how to get the suggestion: "Assign statement to local variable" that Ctrl-1 gives in eclipse. I use that all the time.
只需按一个 Tab 键,Tab 键不会缩进到正确的位置。
多项目是第一个……但很多人之前已经介绍过,所以我会离开它。
窗户的分裂。在 Eclipse 中,您只需将窗口拖动到您想要的任何位置,然后它就会到达那里。
字体很烂。我换到了我能找到的下一个最好的:Liberation Mono,14 号。(设置>编辑器>颜色和字体>字体)
突出显示 XML 令人讨厌...删除了粗体。
将编辑器窗口与在项目导航器中选择的文件同步。默认情况下我不能让这发生,我每次都必须按下按钮???找到了:
在项目导航器中双击有时不会打开文件。有时甚至连三次点击都无法做到。只需单击四下即可打开它!**这里有一个答案...只是双击速度太快了:关于IDEA中的双击,双击打开文件很难的原因是Java程序,例如IDEA读取双击速度来自 X11 资源。如果没有明确设置,则默认为 200 毫秒,这是闪电般的速度。为了有一个更理智的阈值,创建 ~/.Xresources 并添加:*.multiClickSpeed: 400
无法弄清楚如何获得建议:Ctrl-1 在 Eclipse 中给出的“将语句分配给局部变量”。我一直用那个。
** Yep! This is the Introduce Variable refactoring. By default, select some text, and then hit Ctrl + Alt + V. If the expression is incomplete or invalid, IntelliJ will still make a good guess about what you meant and try to fix it for you.
** 是的!这就是引入变量重构。默认情况下,选择一些文本,然后按 Ctrl + Alt + V。如果表达式不完整或无效,IntelliJ 仍会很好地猜测您的意思并尝试为您修复它。
Tab doesn't take line to correct spot right away.
Couldn't get it to auto complete properly ** Ctrl-Shift-Space helps...
Hot code re-run. In eclipse I can modify a method while in the debugger, and it reloads the frame. ** Right-click: drop-frame
Double clicking a variable to highlight it, doesn't highlight other occurrences of the variable.
Deprecated methods are not crossed out.
Can search properly in Settings menu. All it filters out is top level names as opposed to all strings inside menus themselves. Can't find where to set my jdk!
Doesn't compile on the fly, only when I hit 'debug' does it compile.
No 'right-click on class and choose New > JUnit' function.
When debugging, window comes up at bottom and can't move to where I'd like it. ** Drag the small icon when it's collapsed to whichever side you want it to pop out from.
Tab 不会立即走线到正确的位置。
无法正确自动完成 ** Ctrl-Shift-Space 帮助...
热代码重新运行。在 Eclipse 中,我可以在调试器中修改一个方法,并重新加载框架。** 右键单击:丢帧
双击一个变量以突出显示它,不会突出显示该变量的其他出现。
不推荐使用的方法不会被划掉。
可以在设置菜单中正确搜索。它过滤掉的只是顶级名称,而不是菜单本身内的所有字符串。找不到在哪里设置我的 jdk!
不会即时编译,只有当我点击“调试”时才会编译。
没有“右键单击类并选择新建 > JUnit”功能。
调试时,窗口出现在底部并且无法移动到我想要的位置。** 折叠时将小图标拖到您希望它弹出的任何一侧。
Things I do like:
我喜欢的东西:
- Paste history is nice:
- 粘贴历史很好:
Ctrl-Shift-V
Ctrl-Shift-V
Simply clicking the debug/run icons actually runs the last configuration, eclipse isn't that smart with it ( or it's too smart??? ), and I don't like the way it does it.
Autocomplete is very good.
Only click once to add a break-point
Code collapsing/expanding seems nicer.
Ctrl-Shift-- (minus) collapse/fold all.
“Column mode” can be turned on it “Edit - Column mode” or with alt + shift + insert
只需单击调试/运行图标实际上会运行最后一个配置,eclipse 并没有那么聪明(或者它太聪明了???),而且我不喜欢它的方式。
自动完成非常好。
只需单击一次即可添加断点
代码折叠/展开看起来更好。
Ctrl-Shift--(减号)全部折叠/折叠。
“列模式”可以打开它“编辑 - 列模式”或使用 alt + shift + insert
回答by Craig P. Motlin
In eclipse you can maximize the editor and in IntelliJ you can click escape, which is similar functionality. But in eclipse you can restore. There's no equivalent "un-maximize" in IntelliJ which is even more frustrating.
在 Eclipse 中,您可以最大化编辑器,而在 IntelliJ 中,您可以单击转义,这是类似的功能。但是在eclipse中你可以恢复。IntelliJ 中没有等效的“取消最大化”,这更令人沮丧。
回答by Craig P. Motlin
Only eclipse allows you to step through an ant build in the debugger.
只有 eclipse 允许您在调试器中逐步完成 ant 构建。