December is for many people a period of reflection or thought. So I decided to reflect upon last year’s things and thoughts — each day until Christmas. This is day 5.
I switched to IntelliJ IDEA this year as my primary IDE after having used Eclipse all my life.
Eclipse is one of best IDE’s around and I wrote earlier about the Groovy-Eclipse compiler 2.3 when Grails 2.4 was released, Gradle/Groovy support when Grails 3 was released, Eclipse Mars instead of GGTS with GSP support and debugging Grails 3 in Eclipse.
Around the summer I decided to give IntelliJ a try.
Probbly after the Groovy/Eclipse compiler started failing randomly on me with “assert failed” modal popups whenever I try to save Groovy file. This happened more often with very complex or large Groovy files — which meant: losing last few minutes of work, and usually restart Eclipse.
There were definately some things I had to get used to:
- No compiler errors for my Groovy and Grails projects! If I put
@CompileStaticon my classes, Eclipse would have shown red lines everywhere code wouldn’t statically compile in the editor. With IntelliJ all is fine until I boot the project or run the tests – only then some Messages-window pops up saying things don’t compile.
- Almost everything (including above “feature”) Bozhidar Bozhanov (“Bozho”) decribes in why he still prefers Eclipse over IntelliJ – which I won’t repeat here ��
- The friggin’ flippering windows. The Documentation window keeps popping where my cursor is — with the Javadocs of the hovered method/class/whatever — on top of the warning/error which is also shown as a popup. But after twiggling a bit with “Pinned Mode”, “Docked Mode” and “Floating Mode” I finally got it fixed at the bottom of my screen, where it continuously uses some screen estate to show the Javadoc of the current hovered item. Unless I run unit tests which shoves its own window on top instead. And when I place the focus back in the editor itself, whatever tool window was open disappears again, making the code in the editor window “jump” or “scroll” a few lines up or down.
- Just moving the caret, while selecting a word, per ‘part’ of a camelCasedWord, so I could use the arrows on my keyboard to move to the start of “camel”, to the start of “Cased” and start of “Word”. Eclipse does this out of the box, IntelliJ just jumpt to the beginning or end of the entire word. I had to find and configure this thing called “camelHumps” selection. (This was especially annoying when renaming a variable or method in-place and just wanting to rename only a part of the name) We’re ok now.
- Renaming e.g. a class by default also ticked ‘Search in comments and strings’ and ‘Search for text occurences’ — which can be a surprise if (seemingly) random words (but similar enough) in all kinds of comments throughout the code base has been renamed too.
- Much more small things in which IntelliJ is just different.
I can’t begin to sum up where IntelliJ shines — but I’ll try �� — but it includes at least following items:
- Very good Groovy and Gradle support out of the box!
- Alt-Enter anywhere brings up context-sensitive options. Run a test, create a test, create subclass, make public/protected/private, convert to closure property, generate missing test methods, remove explicit type, split into declaration and assigment, flip ‘==’, introduce local variable enz enz — the suggestions are limitless. Eclipse also has good Quick-Fixes of course.
- Great Java 8 support, suggesting lambda notation where appropriate! Even diplaying anonymous inner class usage (collapsed) as if it was written using a lambda expression.
In Eclipse I had to find and install additional plugins for things I wanted or needed which with IntelliJ just worked out of the box for me.
psst…I also started to use Visual Code more and more (you know Microsoft can make something decent? Ok, TypeScript included) ��
|Published on Java Code Geeks with permission by Ted Vinke, partner at our JCG program. See the original article here: X-Mas Musings #5 – Eclipse to IntelliJ|
Opinions expressed by Java Code Geeks contributors are their own.