Three features of Intellij that you will love
This post shares to you 3 powerful features that Intellij supports Java developers.
If you are learning Java or using Java at works, or thought of learning Java, don't miss this post and a series of Intellij productivity tips.
In this post, I use the Intellij's XWin key map.
Disclaim: I'm a fan of Vim, I use Vim for all kinds of writing and coding, until I started working with Java. I realize I need an IDE, and Intellij has showed me that it is my best choice so far, it convinces me that it can improve my productivity drastically.
A list of features that all IDE and editor supports:
- Autocomplete
- Navigate through files and directory
- Fuzzy search
- Fold
- Integrate with Source Code versioning (SVN, Git, etc.)
- Syntax highlighting
- Run/Compile
- Install extensions
- Focus mode
- etc.
And here is the 3 powerful features that I think make Intellij different from other tools:
Smart refactoring
How smart is it?
I was like "Wow! that's so cool" when I use the Rename function of Intellij. It automatically renames all the references to the change.
The renaming feature doesn't just change the name of all occurences, but also recomment to udpate the related expression, like the parameters in the setter, constructor, etc.
Move a file to different package will result all usages get updated.
Another important refactoring that I am using daily is extracting code to function. By pressing the combination key Ctrl, Alt, F, Intellij will suggest me to extract even more similar code together to make the extracted function even more reuseable (by introducing new parameter to the signature of the function).
Display usages and implementation inline
Navigate through a big Java class is a lot of works. We may need to change only 1 line of code, but we probably have to go to many different functions to find out the context. Luckily, you can show the class structure just by pressing Ctrl F12. Inside the class structure dialog, you can show document of the function and its implementation.
To show the function's document, press Ctrl Q; to show the function's implementation, press Ctrl Alt I.
Pro-tip: You can search for the function name in the class structure dialog, just type the function name after open the class structure dialog.
Productivity guide
I usually ask myself whether I take full advantage of the IDE yet. Most of the time I can't tell because different people have different opinions. This isn't a hard answer question with Intellij. There is a built-in feature in Intellij called Productivity guide.
This feature allows us to see the list of productivity practices in Intellij, the frequency we use a productive tips and how to use it. The next day I go to work, I can start trying some productivity tips that I haven't used before.
To open the productivity guide, simply type 'Productivity guide' in the Actions control (by pressing Ctrl Shift A).
Pro-tip: You don't need to remember every hotkeys, all you need to remember from the beginning is the shortcuts to open the Actions Control dialog.
I'm working on another post about most useful Intellij extensions and some tips when coding with Java in Intellij. Make sure you don't miss it.