Own Your IDE

Donald Raab
10 min readJan 31, 2023

--

Customize and extend your IDE for an Integrated Developer Experience.

Photo by Tekton on Unsplash

Your productivity is worth investing in

If you are developing software in a programming language like Java, C++, C#, Python, Go, Ruby, Kotlin, Groovy, Swift, or JavaScript you are probably leveraging a powerful and productive Integrated Development Environment (IDE).

I have been using IntelliJ IDEA for Java development since 2002. Most developers I meet who use IntelliJ, Eclipse, NetBeans or VSCode for coding in Java love their IDEs. They are fiercely loyal. However, few developers I meet take the time to fully learn the capabilities their IDE provides to enhance their productivity. Many developers wind up treating their IDEs primarily as colorful code editors.

There is much more power available and waiting to be discovered. It may take you time to discover and master the features, but that investment will give you greater returns over time.

I’ve been using IntelliJ IDEA for Java development for 20 years. I feel some days like I’m only scratching the surface of productivity gains as my favorite Java IDE continues to evolve and put more power in my hands.

Discovering the keys to the kingdom

In the 1990s, I worked in a Smalltalk IDE. The IDE I used was IBM’s VisualAge for Smalltalk (VAST). VAST was the most amazing development environment I had ever seen or used, and remained so well into the 2000s. I learned that paying ~$5,000 per developer seat for an IDE was well worth the investment in terms of the productivity improvements.

With VAST and the live Smalltalk image I also learned I could change anything I wanted in my environment, on the fly. VisualAge was written in Smalltalk and was a running Smalltalk image and I could learn about and change all of the underlying code, in Smalltalk, dynamically.

When you own your IDE, you don’t just use it to type code, you extend it and enhance it to increase your productivity.

I kept programming in VisualAge Smalltalk through the early 2000s in my spare time. I used to occasionally demo building a ToDoList in under 2 minutes using VAST. I blogged about this recently and how I learned JavaFX as a result to try and replicate that same ToDoList demo-ability in Java using IntelliJ.

VAST wasn’t really keyboard enabled. I was mouse dependent working in the IDE. After my first 2–3 years of programming Java using IntelliJ IDEA, I became keyboard obsessed. IntelliJ really unleashed my productivity using the keyboard. I learned many IntelliJ keyboard shortcuts in the early 2000s that I still use today. I loved using the keyboard so much, I decided to implement the same keyboard shortcuts in my VAST environment… because I could! I started with Ctrl-N (Find Class) and Ctrl-B (step into something like a class or method when the cursor is on the text). This helped balance my productivity when switching between my two favorite and most used IDEs.

Coding like a boss in IntelliJ

I’ve alternated between being an individual contributor and a manager at work over the past six years. I have been a manager of a core platform team at my current employer for the past three years. I read and review more code in this role than I write. I continue to code actively in open source and passed 500 contributions on GitHub last year. Following are some tips I can give you to help you maximize the out of the box capabilities of IntelliJ IDEA so you can code like a boss (me).

These features are built into IntelliJ IDEA. All you need to do to use them is learn them. Whether you pay for your IDE or download it for free, it pays to learn the features that are built-in. Learn them. Customize them. Own them.

Keyboard Shortcuts

Many developers I have worked with over the years have printed out one of these two keymaps and kept them on their desk for reference. In the new world of remote work and going green, maybe just keep a bookmark or save the PDF. Learning many of these shortcuts will save you time doing common every day coding activities. Link to PDF.

Some of my personal favorite shortcuts:

Ctrl-N, Ctrl-B, Ctrl-H, Ctrl-F, Ctrl-Shift-F, Ctrl-Shift-R, Alt-F7, F5, F6, Shift-F6, Ctrl-Alt-M, Ctrl-Alt-N, Ctrl-Alt-Shift-N, Ctrl-W, Ctrl-O, Ctrl-I, Ctrl-P, Alt-F1

The most important basic short-cuts to learn and remember:

Alt-Enter (magic) and Shift-Shift (multi-purpose)

Postfix Completion

I hate typing types when I want to introduce a variable. Sure, I could use the Local Variable Type Inference (var keyword) feature introduced in Java 10. Most of the time I want to keep the types in the code for future readers, including myself, so using var is not an option. When you need to type the types in Java, you wind up repeating yourself, a lot. Don’t Repeat Yourself! Don’t type types for your local variables. Let IntelliJ do it for you, by using postfix completion.

This is truly a boss feature of IntelliJ. If you use another IDE, check to see if they have implemented this feature. This feature will change how you write your code.

Owning Postfix Completion

Once you incorporate postfix completion into your coding style, you can make this feature your own. Since IntelliJ 2018.1, you are able to customize the Postfix Completion by creating your own Java templates.

Go to Preferences | Editor | General | Postfix Completion

Add your own postfix completion shortcuts

For some custom Postfix Completion examples, check out this blog from Craig Motlin.

Type Hints

A feature that was added in IntelliJ 2018.2 that I love was called “Type hints for long method chains” or more simply “Inlay Hints”. If you use a fluent coding style with libraries like Java Streams or Eclipse Collections, these type hints can help you read and understand your code without having to go digging into method chains in order to discover return types. This feature shows intermediate type hints next to the code with long method chains. It has various configuration options you can tweek. Here’s one example using the default settings.

Let’s take a look at some code as it would appear in a browser, with some standard syntax highlighting.

@Test
public void printTop10RandomFruitOrVegetableEmojis()
{
CodePointAdapter emojis = Strings.asCodePoints("🍏🍎🍐🍊🍋🍌🍉🍇🍓🍈🍒🍑🍍🥥🥝🍅🍆🥑🥦🥬🥒🌶🌽🥕🧄🧅🥔");
IntBags.mutable.withAll(new SecureRandom()
.ints(0, emojis.size())
.limit(1_000_000_000L)
.parallel()
.map(emojis::get))
.collect(CodePointList::from)
.topOccurrences(10)
.forEach(System.out::println);
}

Here’s the same code in IntelliJ IDEA, with Type Hints enabled, with the default settings.

Type hints underlined in red

The only thing missing here is what the MutableIntBag is being constructed from. We can find this out by changing the default Type Hint settings.

Change the Minimal unique type count to show hints from 2 to 1 under Java Call chains

The result is that we now additionally see the IntStream.

IntStream is displayed next to the call to ints on SecureRandom

IntelliJ is smart enough to leave out types when they repeat. The calls to limit, parallel, and map all still return IntStream. Type Hints only displays type names when they change. I have decided to leave the minimal unique count setting at one.

Scratches

When I worked in VisualAge for Smalltalk, two of my favorite features were the Workspace and Transcript. Transcript was a special workspace, which was the equivalent of what we know in Java as System.out. The purpose of a Workspace was to allow developers to test out snippets of code to enable learning of new concepts and techniques. I’ve used JUnit tests for years for this purpose in Java. The benefit of using JUnit for this purpose is that little scripts could be easily turned into permanent tests.

IntelliJ has had Scratch Files for a long time, and they can be useful for experimenting with small snippets of code. I kind of think of it as JShell only built into IntelliJ IDEA.

Live Templates

Learn about Live Templates in IntelliJ, and you may quickly create your own minimal programming language. Live Templates give you coding super powers. I haven’t had to write a for-loop by hand in years because of Live Templates.

As soon as you start typing in an editor in IntelliJ it will show you a filtered list of matching live templates. Below is where you can find the standard list of Live Templates for Java in IntelliJ.

Live Templates for Java

There is a plus sign over the right of the screen which you can use to either add new Live Templates or a Template Group. I created a Template Group for Eclipse Collections Factories.

Live Templates for Eclipse Collections Factories

If I am in my IntelliJ editor writing some code, all I have to do to create a MutableList with some elements is type mlw followed by a tab.

Live Template automatic filtering in editor

As soon as I press tab, the code will expand as follows, and place the cursor in position for me to start typing the first element. As soon as I press tab, it will skip to the second element position, moving past the comma. It does the same when I press tab again for the third element.

Much easier to type mlw than Lists.mutable.with

When paired with Postfix Completion, I have a lot less text to type as the types on the left get filled in automatically.

Using Postfix Completion together with Live Templates

This is the result, and then I pick the variable name I want from the list or just type my own.

Postfix Completion result

So if you find yourself coding the same patterns over and over again, create a Live Template with a memorable shortcut. Even if you can’t remember it right away, IntelliJ will display it in the list and the more you use it, the more likely you will be to remember it.

The keyboard shortcut to bring up the list of Live Templates in the editor is Ctrl-J.

For some additional IntelliJ Live Templates tips, check out this blog from Craig Motlin.

Finding and Installing Cool Plugins

There is a a marketplace for plugins for IntelliJ and all JetBrains IDEs. You can find some neat plugins that give you useful features not provided by IntelliJ directly here. Some cool plugins that I discovered thanks to Emilie Robichaud are in the blog below.

Some plugins are free and some are paid. I recommend reading the pricing and reviews of plugins and deciding for yourself which plugins are the most helpful. IntelliJ includes a lot of the productivity tools and plugins developers need in the Community Edition and even more in the Ultimate Edition. Here’s their online comparison of features.

Building Your Own Plugins

So far I have shown some features you can use and customize for good effect at increasing the productivity of your IDE. There is another super-power that you can leverage to extend the IDE for a truly comprehensive Integrated Developer Experience (IDX). Build your own plugins that integrate with your internal development platforms.

Sirisha Pratha gave a great talk tirled “Make IntelliJ IDEA Your Own”. I am linking to it here.

If you want to learn how to build custom plugins for IntelliJ, this is a great talk to watch.

Own Your IDE for Your Own Good

I clearly use IntelliJ IDEA as my IDE, and have shared some useful tips that can help you own it for improved productivity. Regardless of which IDE you use, I recommend taking the time to learn the facilities the IDE provides for you to increase your productivity. If your IDE is competitive, I would expect it to have equivalents of

  • Keyboard Shortcuts
  • Postfix Completion
  • Scratch Files
  • Type Hints
  • Live Templates
  • Plugin Architecture and Marketplace

If your IDE doesn’t have the equivalents of these things, then you might want to suggest implementing them to your IDE provider. If you use an OSS IDE, then you might consider contributing improvements.

You are responsible for your productivity. You need to own it, and that means investing in it. Whether you get your IDE for free or pay a vendor for it, the cost of learning and extending your IDE will be worth the investment.

I am the creator of and a Committer for the Eclipse Collections OSS project which is managed at the Eclipse Foundation. Eclipse Collections is open for contributions.

--

--

Donald Raab

Java Champion. Creator of the Eclipse Collections OSS Java library (https://github.com/eclipse/eclipse-collections). Inspired by Smalltalk. Opinions are my own.