IntelliJ IDEA
IntelliJ IDEA – the Leading Java and Kotlin IDE, by JetBrains
‘Quick’ Features in IntelliJ IDEA
A few IntelliJ IDEA features or actions include the term ‘quick’. Do they speed up certain processes? Let’s find out. In this blog post, I’ll cover what these features are, why you need them, and how you can use them.
1. Quick Lists
If you have actions that you use regularly but don’t have shortcuts assigned to because most key combinations are usually taken up by other shortcuts, Quick Lists are here to help.
With a quick list, you can create a short list of your favorite actions, and assign just one shortcut to it. Each action in the list will be identified by a number from 0 to 9. To access this list, you just need to remember one shortcut and a number for each of the actions on the list.
To create a new list, access the settings and find ‘Quick List’ under ‘Appearance and Behavior’.
Create a new list and assign a name and a short description to it. Then go to the keymap, and assign a shortcut to the list you just created. Don’t worry if you don’t remember the name of this list when you have to actually use it. You can use the shortcut to access your list, or use ‘search everywhere’ to find and use it. The following gifs show these steps:
IntelliJ IDEA also offers predefined lists, such as ‘Refactor this’, ‘VCS operations’, and others, but you can’t modify these lists.
2. Quick Switch Scheme (Ctrl + `)
Quick Switch Scheme is a handy, predefined list of features about how you can quickly switch between the various display schemes in your IDE, like the overall theme, editor color scheme, keymap, view mode, zoom, and a few more.
You can invoke this feature by using the shortcuts (Ctrl + ~ on Windows / Linux and Cmd + ~ on macOS) or by using find action ‘Quick Switch Scheme’.
When you select the option ‘Theme’, you can cycle through the themes available for your IDE. If you wait for 3 seconds on a selected theme, you can view how that theme will look before you select it. You can also install new themes from here.
The keymap option lets you replace the current keymap with a list of other available options. You can also select to configure or install a keymap.
By using the view mode, you can switch to the five predefined view modes – presentation mode, distraction free mode, full screen, zen mode, and compact mode. By default, the IDE doesn’t assign a shortcut to them, but if you assign a custom shortcut to them, they will appear here.
The zoom option lets you increase the overall font size of your IDE. This is very handy if you are presenting code to your colleagues or others and want to change the zoom across the IDE.
3. Quick Definition
Imagine you are scrolling through a class, ShoppingCart, in your project and are unsure of the contents of another type, ShoppingItem. Is there a way to read its contents without losing your coding flow? You could navigate to the source code of the class ShoppingItem by using the feature Go to Declaration, but this would open that source code in another window, disrupting your coding flow.
Instead, you could use the Quick Definition feature and open the definition of any other type (class, interface, record, enum, etc.) as a popup in your editor window. Just place your cursor on the type and invoke ‘Quick Definition’ (shortcuts – Ctrl+Shift+I on Win/ Linux and Cmd+Shift+I on macOS, or click View | Quick Definition in the main menu).
Here’s a gif showing this:
You might also not remember where or how a variable is defined, as often happens when you are reading a long method. You can see where and how symbols, such as classes, fields, methods, functions, or tags are defined in your project by using this feature. Using the more popular ‘Go to declaration’ feature might disrupt your flow. Using a quick definition is a good alternative as in the following gif:
When you use Quick Definition, it doesn’t show the documentation for a type, meaning the Javadoc comments that start with /** and end with */. However, it does shows other comments like multiline comments (starting with /* and ending with */) and single line comments that start with //
Is there a way to view the Documentation of a type in a similar manner? Yes! The answer is quick documentation.
4. Quick Documentation (Ctrl + Q)
You can use ‘Quick documentation’ to view JavaDoc documentation for a type displayed in a popup in your editor window.
Imagine you are browsing through the source of your class, ShoppingCart, which defines an instance variable of type List, and your class calls add method from List. Instead of diving into the code of this method, you want to know what the documentation says about the add method.
To do so, you can move your cursor to the method call add, and use the shortcut Ctrl+Q (for windows/ Linux), and Cmd+Q for macOS. The following gif shows this:
Summary
‘Quick’ features can be quite helpful.
Quick lists can help you group actions related to your tasks (like deployment or code demos). Quick Switch Scheme is a list that includes actions to switch across various UI elements of the IDE, themes, views, keymaps, zoom, and others.
Quick definition and quick documentation let you refer to definitions or documentation of a class, method, variable, etc. as a popup in your IDE. This prevents interruptions to your coding flow when you navigate to the source code of a class in a separate window.
Happy coding!