JavaRush /Java Blog /Random EN /IntelliJ IDEA - Not big, great tips.
Level 16

IntelliJ IDEA - Not big, great tips.

Published in the Random EN group
This time, I would like to share a few tips for using IntelliJ IDEA that can make coding productive and enjoyable at the same time. No matter how insignificant they may seem at first glance, over time they will have a huge impact on your productivity. At least that was their effect for me.
Method separators
Let's start with something simple. Horizontal lines visually separating methods improve code readability. IntelliJ IDEA - Not big, great tips.  - 1 If you want to visually separate methods, go to settings by pressing Ctrl + Alt + S, start typing what you are looking for - "sepa..." (English "separators" - Russian "Separators"). IntelliJ IDEA - Not big, great tips.  - 2 You'll see the dialog gradually limit its content to show only the relevant entries in the settings. Check the "Show method separators" checkbox. Take the advice on searching for text inside the settings dialog as a free bonus.
Calling a command by name
It has been proven that searching is faster than browsing. IDEA allows you to call commands such as refactoring or code generation by name (or just part of it). To see the magic, select a block of code to refactor and instead of going to the menu, press Ctrl + Shift + A. In the window that appears, enter the name of the command you want to execute. Non-full names are allowed. IntelliJ IDEA - Not big, great tips.  - 3 I'm sure it's faster than searching in the menu.
Go to element
The last example of search and navigation. Searching for a method or variable when you remember only the name or part of the name, but forgot in which file\class it was defined. Ctrl + Alt + Shift + N is a quick way to find an element in your project. IntelliJ IDEA - Not big, great tips.  - 4 It does not depend on how deeply the element is hidden.
Element highlighting
I start to like this feature over time. Highlighting all occurrences of an element in the editor can be a good help. IntelliJ IDEA - Not big, great tips.  - 5 Not surprisingly, the feature works equally well in other supported technologies, such as HTML or JavaScript. To use the feature, press Ctrl + Alt + S to open the settings dialog, look for "Highlight usages of element at caret" and check the box. IntelliJ IDEA - Not big, great tips.  - 6 Ready.
Block selection
Copying a section of code or applying refactoring requires selecting part of the code. Using Ctrl + W expands the selection area around the cursor, Control + Shift + W makes it smaller. Use the function to always select a semantically correct block of code. IntelliJ IDEA - Not big, great tips.  - 7 This function works just as easily in other supported languages, not just Java.
Comparison with clipboard
Last trick for today: Now that you know how to effectively highlight a block of code, how about comparing it to the snippet you received from your colleague via email? Or with a class in the org.project.used.but.unmainteintable package? IDEA allows you to quickly compare a selected block of code with the contents of your clipboard. In fact, it goes even further. You get a complete set of merge tools that let you make code changes or copy and delete individual parts of code as blocks. Let's refresh what we learned earlier, remember the key combination for calling commands by name? Correct answer: Ctrl + Shift + A. IntelliJ IDEA - Not big, great tips.  - 8 And here is the merge tool: IntelliJ IDEA - Not big, great tips.  - 9
These were some of the little productivity gems I wanted to talk about today. What tricks do you use? Share your experience in the comments. Original article: IntelliJ IDEA - Small tips with big value Translated