maximize-your-coding-speed-with-intellij-idea
We all live in a time where everything needs to be fast, where productivity and efficiency is our first priority. In this article we will discuss how to crush it as a Java developer using IntelliJ IDEA as your main integrated development environment.
In the past few years this tool was highly updated and improved as Java versions were also launched more frequently. Because of that, if you just heard about it or you are already using it but didn’t have time to explore all it’s amazing features, then this post is for you.
Without further ado, these are the newest and must use features, shortcuts and plugins that you should know about in order to get the most of your time using this IDE. Note that what we’ll include here is available for both Community and Ultimate Edition of IntelliJIDEA.
I. Features and Integrations
a. Version Control
· For cloning Git/Mercurial/Subversion projects go to:
File -> New -> Get from Version Control
· For using other Git commands like push, pull, fetch, or for starting a new Pull request just choose option Git from the bar menu.
b. Automatic JDK Download
· If you need to download a new JDK for your project, just go to:
File -> Project Structure ->SDKs -> Download JDK
c. Code Vision
· A nice feature that allow you to see the number of usages and implementations of an element, enable it by going to:
File -> Settings -> Inlay Hints -> Java ->Code Vision
d. Problems View
· Whenever you have a problem in your class, a red widget will appear at the top of your class name, displaying the number of related problems. Clicking on i it will open the Problems view where you can see all the problems in the project related to this issue.
e. Live Templates
· This allows you to only type certain keywords and then a piece of code is generated for you, some of the most common examples are:
sout, main, psvm, fori, ifn etc.
· In order to see all the available Live Templates, to update the existing ones, or to create a new one, just go to:
File -> Settings -> Editor-> Live Templates
f. Services window
· This is useful when trying to manage a service like Docker; we can create new containers from images, run containers, stop containers etc.
· It can be accessed by going to:
View -> Tool Windows ->Services
g. Dataflow analysis
· This feature gives you hints about the values that your variables or method calls will have in a future execution
· In order to see it in action use this shortcut on a method call:
SHIFT + CTRL + P (for Windows)
h. JShell Console
· You can easily test your Java code functionality by writing it down in this console, which can be accessed at:
Tools-> JShell Console
i. Run commands using IDE
· If you want to run a command in the Terminal, but using IntelliJ’s features instead of the classic terminal one, just press:
CTRL + SHIFT + ENTER (for Windows)
We are just scratching the surface here, in order to take fully advantage of the tool, you can try following the “Tip of the day” window when you first launch IntelliJIDEA or install the IDE Features Trainer plugin.
I. Shortcuts
We all love shortcuts. They make our life easier and keep us productive when trying to access certain actions. We will shortlist the most important ones, which you should consider using in your daily workflow. For readability, we will only see the ones for Windows OS:
a. CTRL + SHIFT + ENTER: Complete current statement
b. ALT + J: Add selection for next occurrence
c. CTRL + SHIFT + UP/DOWN: Move statement up/down
d. CTRL + ALT + N: Inline variable
e. CTRL + ALB + B: Go to implementation
f. CTRL + K: Opens commit window
g. CTRL + ALT + M/ CTRL + ALT + V: Extract method / Extract variable
h. CTRL + ALT + RIGHT / CTRL + ALT + LEFT: Navigate Forward / Back
i. CTRL+ E: Opens Recent files window
j. SHIFT x 2: Search everywhere
k. CTRL + O / CTRL + I: Override/ Implement methods
l. ALT + 1: Opens up Project window
m. ALT + INSERT: Create new file
n. SHIFT + F6: Rename and refactor
o. ALT + ENTER: Show context actions
p. ALT + F12: Opens up Terminal window
For a full list of available shortcuts you can visit this link: https://resources.jetbrains.com/storage/products/intellij-idea/docs/IntelliJIDEA_ReferenceCard.pdf
I. Relevant plugins:
a. Codota: Best AI code completion for Java and JavaScript
https://plugins.jetbrains.com/plugin/7638-codota
b. Rainbow Brackets: Helps for better code readability
https://plugins.jetbrains.com/plugin/10080-rainbow-brackets
c. Lombok: Offers support for Project Lombok
https://plugins.jetbrains.com/plugin/6317-lombok
d. Key Promoter X: Helps you learn essential shortcuts of IntelliJ IDEA
https://plugins.jetbrains.com/plugin/9792-key-promoter-x
e. Extra Icons: Adds icons for different file types
https://plugins.jetbrains.com/plugin/11058-extra-icons
f. Kubernetes: Offers support for configuring Kubernetes
https://plugins.jetbrains.com/plugin/10485-kubernetes
g. Presentation Assistant: Displays shortcuts that you use and a short description
https://plugins.jetbrains.com/plugin/7345-presentation-assistant
h. IDE Features Trainer: Learn essentials features and shortcuts inside the IDE
https://plugins.jetbrains.com/plugin/8554-ide-features-trainer
For other useful plugins you can check out this website:
https://mytrashcode.com/best-intellij-plugins
Although IDEs are just tools and improving your technical skills will also make you write code even faster, knowing your environment at best makes the whole development process much more enjoyable and efficient.
IntelliJ IDEA groups a lot of features in one place, helping you to keep focus and not being forced to switch between third party apps in order to execute certain actions.
Great tutorials on how to use all IntelliJ IDEA’s features can be found on their official YouTube channel, at: https://www.youtube.com/channel/UC4ogdcPcIAOOMJktgBMhQnQ