IntelliJ Toolbox Teil I

26.03.2020 Raffael Schneider
Tech intellij ide toolbox goodtoknow handson

We at b-nova use JetBrains IntelliJ as our preferred IDE every day. It's not just up to us to make programming fun again, but also the features that IntelliJ provides. Over time, the editor ecosystem has grown enormously. Just think of, VS Code or the umpteenth imitation of vi. The scope is now so large that most of us - including us at b-nova - no longer know what it is all about. So we thought we'd put together a list of useful tips and tricks for you to choose from to make your everyday life easier.

Find Action

Before we take a closer look at various tools, let's start with a very practical shortcut. If you've never heard of Find Action or thought about what this does, check it out and you definitely want to no longer live without it.

With the help of the key combination Shift + Command + A you can find any features directly from the prompt, no matter how hidden. For example, you want to find Save Actions, then open the Find Action window and look for it. You can find the settings without touching a menu or a mouse / touchpad. Useful isn't it? It works with pretty much everything.

From MacOS version 10.14.4. the shortcut opens the terminal. However, there is already an official Blog Post which fixes this problem.

Regex checker

Do you know the need to make sure that your regex expression recognizes the correct elements? Have determined they mostly used an online service to check this out. As you can already guess, IntelliJ offers such a service by default. This is called Regex Check.

To use this, move your mouse over the regex expression and press Option + Enter. Then select within the tooltip Check RegExp. This will open another small window where you can review or adjust your expression to get the result you want.

Scratch files

A common habit is to use some type of code clipboard to hold a piece of code, for example adapt it, paste it somewhere with copy / paste or just to try something without a commit having to do within your project workspace. Usually you use another editor for this, but IntelliJ offers another practical feature that makes this superfluous. This feature is called Scratch Files.

scratch files are actually temporary design files that do not influence your project and also is not included in your SCM. The files are fully functional, i.e. they have syntax highlighting and are also executable and / or can be used in debug mode. To such a file to create, select New > Scratch File within the context menu or simply use the shortcut Shift + Command + N. As already mentioned, the files are available in your project, but not in your workspace. As soon as you no longer need them, they can be removed.

REST client

Directly after the scratch files comes the next feature: fully integrated support for an HTTP client directly within your IDE, which can be used with scratch files. There are a few Third-party tools, like Postman, which basically offers the same functionality. However, having the option of using such a tool directly in IntelliJ makes it all the more convenient for you to test web service. IntelliJ's own HTTP client is very powerful, so be sure to use JetBrains official documentation once take a closer look.

To use it, all you have to do is create a new scratch file with the shortcut Shift + Command + N. You now have to change the file type to .http (or alternatively .rest). Within this file you can now create REST statements and, as soon as you are finished, test them directly.

Just write a statement like GET and then the green one Start-Button click on the left side of your window. This causes the HTTP client to make a GET call make the given address and deliver the corresponding answer. Now you can have so many parameters and values add to achieve the desired result.

Connection: keep-alive Accept: text/html Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.8

There is also a cURL conversion facility from IntelliJ that allows you to convert a cURL statement into a valid .http statement. You can also do this via the context menu Tools > HTTP Client > Convert cURL to HTTP Request. There you can enter the cURL expression.

$ curl '' -H 'Connection: keep-alive' -H 'Accept: text/html'

This creates an HTTP body as shown above

Dependency Structure Matrix

Last but not least, we will show you a feature that sounds more complicated than it actually is, namely Dependency Structure Matrix. Although it may seem daunting at first, this is a very easy one to do an easy-to-use tool that can improve the overall architecture of your application. In short, this makes relationships between modules, files and / or classes visual on a matrix graph shown. The DSP, short for Dependency Structure Matrix, has only been available for a few months and is in our opinion definitely worth the time to take a closer look.

If you want to learn more useful things about IntelliJ, be sure to check out these two official pages in more detail:

Jetbrains IDEA Pro Tips Jetbrains IDEA Tips & Tricks blog (regurarly updated) < / a>

This text was automatically translated with our golang markdown translator.

Raffael Schneider – crafter, disruptor, free spirit. As a fervent software craftsmanship, Raffael likes to write about programming languages and software resilience in modern distributed systems. Be it DevOps, SRE or systems architecture, he always got a new way of approaching things.