The Truly Hidden Gems of IntelliJ IDEA
The IntelliJ IDEA: how2pro blog series showcases useful yet little-known features in IntelliJ IDEA. This time we decided to take it a step further and collect a bunch of features that even most of us at JetBrains didn’t know about! Let’s take a look at some true gems of the IDE you thought you knew so well.
Preview files from search results
IntelliJ IDEA provides several options for previewing files from the Project tool window. For example, you can use the Preview tab or press Space to preview a file in a popup.
But that’s not all. Did you know you can also preview files from search results, like in the Search Everywhere or Go to File dialog?
Press ⇧⌘O on macOS / Ctrl+Shift+N on Windows and Linux in your project to open the Go to File dialog. Start searching for a file, and once you see your search results, select any item in search results and then press ⌥Space on macOS / Ctrl+Shift+I on Windows and Linux.
The selected file opens in a popup, allowing you to go through its contents and decide whether or not you want to open it for editing. Press Esc to close the popup and continue working with the search.
Convert a Maven dependency to Gradle
If you have a Maven dependency that you want to use in your Gradle project, you don’t need to search for this dependency in Gradle. Just copy this Maven dependency and paste it to your Gradle build file as is.
IntelliJ IDEA recognizes the format, automatically converts Maven XML to Gradle DSL, and pastes it as a Gradle dependency.
Paste Java code like a pro
You can paste Java classes to your project in a quick and convenient way.
Copy the necessary class from elsewhere so that you have it in your clipboard. Then, switch to the IDE and press ⌘1 on macOS / Alt+1 on Windows and Linux to open the Project tool window.
In the tool window, select the folder to which you want to paste your code. Press ⌘V on macOS / Ctrl+V on Windows and Linux, or right-click the folder and select Paste.
IntelliJ IDEA automatically creates a file with the correct class name and puts the contents of the clipboard into that file.
You may know about the Compare with Clipboard feature that allows you to compare the selected piece of code with the code that you have in your clipboard. IntelliJ IDEA has a similar feature that enables comparing two versions of almost anything.
Press ⇧⌘A on macOS / Ctrl+Shift+A on Windows and Linux to open Find Action and type ‘Open Blank Diff Window’. In the tab that opens, paste two versions of any code or text you like and see how they differ.
Sometimes, even the things that we know in-and-out can still hold surprises. We hope that one or two things we mentioned in this post managed to surprise you. Leave us a note in the comment section with the feature that you find the most head-spinning, and stay tuned for more awesome IntelliJ IDEA features!
Oh, and we’ve just released the brand new IntelliJ IDEA 2021.2, now available for download on our website. We’ve been working on it for the last several months and we’re excited to hear your feedback!
Subscribe to Blog updates
Thanks, we've got you!
String Templates in Java – why should you care?
TLDR; The existing String concatenation options are difficult to work with and could be error prone. String Templates (a preview feature introduced in Java 21) greatly improves how we create strings in Java by merging constant strings with variable values. The name of this feature pretty much says …
Java Annotated Monthly – November 2023
Welcome to the Java Annotated Monthly – November 2023! As the Java world keeps on spinning, we've gathered a treasure trove of articles, talks, and insights to warm your Java developers’ hearts. This month's edition features a delightful blend of the latest technological advancements and the ever…
The Best of IntelliJ IDEA’s HTTP Client
In today's fast-paced tech world, easy and efficient management of web services and APIs is crucial. That's where IntelliJ IDEA's HTTP Client steps in, turning complex HTTP requests into a walk in the park. The HTTP Client is a feature-rich, text-based tool in IntelliJ IDEA Ultimate. It seamlessl…
Java Annotated Monthly – October 2023
Welcome to the October edition of Java Annotated Monthly! In this issue, we're plunging into the world of Java and tech. We'll explore the latest and greatest in the recent release of Java 21, share exciting news about the new EAP for IntelliJ IDEA 2023.3, and bring you a handpicked selection of …