Change Project Colour

5 Tips for Your JetBrains IDE Interface

When I started this blog post, I was targeting ways to configure the so-called “New UI”, but as it turns out, not all my tips are related to that, so sit back, relax and see if something appeals to you!

Back in the old days, several of us devised ways to configure the old UI to make it more efficient for our workflow and to remove aspects that cluttered the interface. The so-called “New UI” is much kinder on the eye and easier to work with, but I still have some tips and recommendations for increasing your productivity. That’s the last time I will call it the “New UI” since it’s not so new anymore!

1. Learn tool window shortcuts

One of the biggest criticisms I am aware of was the decision to remove numbers from the tool window icons. I’m going to say it, please don’t hate me, but try and learn the shortcuts. The ones for the tool windows all take the same form, that is:

macOS
Cmd+<number>

Windows
Alt+<number>

You might be reading this thinking, “I can’t learn all 10!”; you don’t need to! Here are the common ones:

Cmd+1 / Alt+1 Project 
Cmd+4 / Alt+4 Run
Cmd+9 / Alt+9 VCS

I also use Cmd+8 / Alt+8 for the Services tool window a fair bit, too, but start with your Project, Run and VCS, that’s the basics and only three shortcuts – or just the number 149. You got this!

If you’re still not convinced, you can always head into your Settings, search for “tool windows”, and select the checkbox that says Show tool window names. It’s even better than numbers, if a little less pretty, in my opinion, but it is there if that works better for you:

JetBrains Interface with toolbar buttons

2. Don’t use editor tabs

I might horrify you with this one – you can turn off the tabs in the editor and still find everything you need quickly. Head into your Settings again and search for “editor tabs”. You’ll find what you’re looking for under Editor | General | Editor Tabs.

From the Tab placement drop-down, select “None”. Now, instead of having that space consumed at the top of your editor, you have more real estate for coding tranquillity. Before you start to worry about how to get to your files, add a new shortcut to your repertoire:

Recent Files
Cmd+E / Ctrl+E  

Recent Files is a mouse-free way of moving around the files that you have open. If you add a Shift into the shortcut, you get Recent Locations, which is arguably even more helpful: 

Recent Locations
Cmd+Shift+E / Ctrl+Shift+E 

You can think of Recent Files/Locations as your working context, so you don’t need Editor Tabs to show you that anymore:

Recent Locations in JetBrains IDE

If you want to learn more about working with a tabless UI check out this tip in our JetBrains Guide.

3. Turn the navigation bar off

The status bar is now in the navigation bar itself. How you configure this depends on the language you’re working in and how you like your IDE to look, but for me, I like the status bar on and the navigation bar off.

You can turn the navigation bar off with View | Appearance | Navigation Bar | Don’t Show:

Navigation Bar Don't Show in JetBrains IDE

This should mean that your status bar runs along the bottom uninterrupted (unless other settings are at play). You can click a status message to open it in the notifications tool window.

If the navigation bar is part of your workflow and you want it back, I suggest putting it at the top of your file instead of in the status bar.

4. Show virtual space 

Here’s a lesser-known option if, like me, you dislike working at the bottom of your screen. There’s a lesser-known option in your Settings (Cmd+, / Ctrl+Alt+S) called Show virtual space at the bottom of the file:

You can now work where your eyes are comfortable without adding white space to VCS! 

5. Change your project colour

Lastly, this one is great if you’re constantly flicking across multiple projects. You can now colour-code your projects to give your eyes a visual hint of what’s where. Right-click on your project name and choose Change Project Color:

Change Project Colour

Naturally, you can customise the colour as well.

Summary

To recap, the five tips that I recommend are:

  1. Learn tool window shortcuts
  2. Don’t use editor tabs
  3. Turn the navigation bar off
  4. Show virtual white space
  5. Change your project colour

Happy coding, and let me know what your top tips are in the comments!

Getting started with IntelliJ IDEA

First up, I have created a tutorial on the IntelliJ IDEA Guide if you want to view the content with videos. I’ll concentrate on text-based for this blog post.

When someone new joins your team, it can be quite an overwhelming experience. There are lots of people to meet, new technologies to learn, different processes to learn and of course, an IDE to learn! It’s helpful to remember what every new starter wants – they want to make a difference, they want to add value, they want to move the needle.

I have created these tips and grouped them to help everyone who is new to IntelliJ IDEA learn in logical groups. You don’t need to know everything in the IDE to be a badass developer, but learning a bunch of functionality that will help you to go faster in 80% of cases is a great way to start. I’ve ordered these tips in the order you’re most likely to want to get to grips with them, but feel free to choose your own adventure!

Working together

There really is no substitute for sitting next to someone and pairing on something in the IDE; it’s a great way to learn a bunch of new keyboard shortcuts and see how your peers use the tool. However, the world was reshaped a few years ago, and now remote working is commonplace, which means you may not be co-located with your peers to benefit from this way of learning. This is where JetBrains Code With Me can add a lot of value, especially if you use it with the Presentation Assistant plugin loaded so you can see the host’s keyboard shortcuts. There are some licensing considerations to be aware of, but it’s available in IntelliJ IDEA Community edition for individual users of up to 3 users for 30 minutes for free.

You can watch these videos to learn more about Code With Me:

And read about it on the JetBrains blog:

…. and finally, the step in the IntelliJ IDEA Guide.

Learning the IDE

This one seems kinda obvious… of course, you want to Learn the IDE; that’s why you’re here! That said, you may not know about the Feature Trainer because it’s a relatively recent addition to the product. You can access the Feature Trainer from the home page by clicking on the Learn tab, or, if you’re already in a project, go to Help > Learn IDE Features.

The current lesson list is:

  • Onboarding tour
  • Essential
  • Editor basics
  • Code completion
  • Refactorings
  • Code assistance
  • Navigation
  • Run and debug
  • Git

Each of these has several lessons within it that take you through a feature that can help you in your workflow. Even not-so-new-starters can learn something from the Feature Trainer, so go ahead and check it out on a Friday afternoon when you have some headspace to learn something new.

…. and finally, the step in the IntelliJ IDEA Guide.

Customising your IntelliJ IDEA Environment

Since we spend a large portion of our day working inside the IDE, it’s reasonable to assume that we will want to customise it for our eyes. Of course, this is separate to code style, which should be standardised across the team you’re working with; that’s one advantage of checking in your `.idea` file. When you’re new to IntelliJ IDEA, the Preferences/Settings dialog (⌘, | Ctrl+Alt+S) can be quite daunting but you can search for what you’re looking for, such as “theme”, “keymap”, “plugins” or “font”.

…. and finally, the step in the IntelliJ IDEA Guide.

Navigating Code

One of the first tasks you have when you are getting to know a new codebase is how to move around it. Again there are lots of ways to do that in IntelliJ IDEA, but I’ve focused on the ones that I think are most helpful for new users. Of course, you can use the Project tool window to move around your files, but I recommend getting comfortable with both Recent Files (⌘E | Ctrl+E) and Recent Locations (⌘⇧E | Ctrl+Shift+E) as these can be thought of as your working context.

As you get more familiar with the structure of the codebase, I recommend you add Go To Declaration or Usages (⌘B | Ctrl+B) and Go to Implementation (⌘⌥B | Ctrl+Alt+B) to your repertoire.

Finally, as you start to figure out your workflow you may need to move between files in a sequential order; this is where (⌘[ | Ctrl+Alt+←) to go backwards and (⌘[ | Ctrl+Alt+→) to go forwards comes in.

…. and finally, the step in the IntelliJ IDEA Guide.

Finding Code

As you move from looking around the code to looking for specific code that performs a task, you can get a lot of support from your IDE. Search Everywhere (⇧⇧ | Shift+Shift)  and Find Action (⌘⇧A | Ctrl+Shift+A) are great ways to narrow down your search in the first instance. As you progress to more specific searching, I recommend you check out Structural Search by using either Search Everywhere or Find Action and typing in “structural”. You can then build your own queries as required. There’s an example in the link below for the IntelliJ IDEA Guide.

…. and finally, the step in the IntelliJ IDEA Guide.

Reading Code

As we all realise as we progress through our careers, we spend more time reading code then writing it. Maybe we wrote that code, or someone else wrote that code; either way you often need to understand what some code does.

Tools you can use to help you read code include Inlay Hints, which you can turn on and off in the Settings and Preferences (search for “inlay hints”). These decorate your code with annotations that can help you to understand the flow of data.

The scrollbars are another great source of information. Coloured blocks on the left-hand scroll bar show you if code has been added, deleted, changed or has an error in for the code you are currently viewing. The right-hand scrollbar shows you the same information for the whole file so you can see at a glance without scrolling if you have any errors and if everything is as you expect it to be.

Finally, sometimes you’re reading code because you’re fixing bugs. IntelliJ IDEA has an Inspections Widget, which appears at the top right of the file by default. This tells you the state of the file and if there are any errors. You can either click on it to open the Problems tool window, go to the next error directly with (F2 | F2).

…. and finally, the step in the IntelliJ IDEA Guide.

Understanding Code

When you come across a block of code that you don’t fully understand, you can use Context Actions (⌥⏎ | Alt+Enter) to see if IntelliJ IDEA has any suggestions for reshaping the code without changing what it does. This is worth doing even if there’s no highlighting on the code to indicate a potential refactor.

IntelliJ IDEA also allows you to Find the Type (⌃⇧P | Ctrl+Shift+P) which can be a helpful shortcut to remember, especially when you’re working with larger, more complex blocks of code.

Finally, you can analyse the flow of data through your code with Code > Analyze Code > Data Flow to Here and to analyse data flow downstream use Code > Analyze Code > Data Flow from Here. Using data flow analysis allows you to track both the data input (producer) and as the data output (consumer).

…. and finally, the step in the IntelliJ IDEA Guide.

Writing Code

Writing code is of course part of our day job and, again an area that IntelliJ IDEA can support you. As you’d expect from your IDE, IntelliJ IDEA gives you extensive code completion including Type-Based completion (⌃␣ | Ctrl+Space), which filters the list to only types that apply to that specific context. Support for code generation is extensive. You can use (⌘N | Alt+Ins) both in the Project tool window and in the editor to generate new files and common code constructs.

Similar to Search Everywhere, IntelliJ IDEA supports Running Anything (⌃⌃ | Ctrl+Ctrl) which you can use to run any of your Run Configurations as well as scripts and commands such as `mvn clean` or `gradle –status`.

Lastly, IntelliJ IDEA has recently made a number of changes to support you in managing dependencies. You can use the new Dependencies tool window to view and update your dependencies using the Package Search functionality.

…. and finally, the step in the IntelliJ IDEA Guide.

Changing Code

Changing code is one of those inevitabilities in our jobs. Perhaps we’re refactoring it, adding functionality or deleting it; either way, you will be changing some code you or someone else wrote at some point. Use (⌃T | Ctrl+Alt+Shift+T) to pop up the refactoring menu. Once you’ve refactored code, you can reformat the code with (⌥⌘L | Ctrl+Alt+L).

Maybe you want to make the same change in multiple places; IntelliJ IDEA allows you to create multiple carets either in a stacked list or randomly as required. ( | Ctrl) twice, holding it down the second time and then pressing the Down arrow to create a stack of carets or by clicking in your code to add a caret. You can learn more about this feature from this blog post on foojay.

Sometimes, especially with long blocks of code or poorly formatted code, it’s hard to see where scope starts and stops. You can use (⌥↑ | Ctrl+W) to expand the scope and (⌥↓ | Ctrl+Shift+W) to collapse the scope.

IntelliJ IDEA supports as many clipboards as you need meaning everything you copy inside IntelliJ IDEA is available for you to paste, even if it wasn’t the last thing you copied. One of my favourite features is being able to copy multiple things and then pasting them in one list from the Clipboard History (⌘⇧V | Ctrl+Shift+V).

Lastly, sometimes things go wrong, and it can seem like you’ve lost your work. IntelliJ IDEA takes snapshots of your code while you work (no save necessary!) when certain events happen. Those events might be refactoring a piece of code, a test passing or failing, or some other change you make. These changes are stored as your Local History. While it is not a substitute for a version control system such as Git, Local History can step in and help when things take an unexpected turn. You can access Local History from the right-click context menu both at the directory level in the Project tool window and on an individual file basis. The diff view it provides allows you to select which changes you’d like to restore to your file, or perhaps the whole file!

…. and finally, the step in the IntelliJ IDEA Guide.

Testing Code

Of course, you want to test your code! Perhaps you’re even doing TDD, but how can IntelliJ IDEA help you here? First up, you can split windows in the editor, allowing you to have your code on one side and your test on the other so you don’t have to flick between them. You can open any file from the Project tool window in a right split by holding down ( | Shift) when you press ( | Enter). The same tip works to open a file from the Recent Files dialog (⌘E | Ctrl+E).

Sometimes it’s helpful to jump from the file to its associated test if it has one. If you’re in a class and use Navigate to Test (⇧⌘T | Ctrl+Shift+T), IntelliJ IDEA will look for a test that it thinks tests that file. For example, if your class is called BlueMoon, IntelliJ IDEA might reasonably assume that a file called BlueMoonTest is in fact the test for that file and take you there. If you use Navigate to Test and IntelliJ IDEA can’t find a test class it will suggest creating a new one for you and offer to generate some test method code constructs.

…. and finally, the step in the IntelliJ IDEA Guide.

Seeing How Far You’ve Come

The Productivity Guide in IntelliJ IDEA is a fun way to see which shortcuts you have used and which you have yet to try. You can access it from Help > My Productivity. Check it out to see what you could learn next!

…. and finally, the step in the IntelliJ IDEA Guide.

 

Using Code With Me to Collaborate on Getting to Know IntelliJ IDEA

As I’m sure you remember, back in March 2020 the office dwellers were sent home indefinitely. I recall my colleagues expressing opinions from “this is silly and will only last a week” to “this marks the point the world changes forever”; those in the latter group were much closer to reality. I was on holiday at the time so when I returned, I duly drove into the office, loaded everything from my desk into my car and settled into working on the dining room table – sound familiar?

After a few months of working at the dining room table we too moved from “this is silly” to “the world is changing”. I made space in our tiny box room and tried to make a workspace that was conducive to productivity. Another few months passed and a series of fortunate conversations led to me interviewing at JetBrains for a Java Developer Advocate. They hired me (yay!) and I started my new job in July 2020. That was it, I was one of them, I was remote, but I wasn’t alone.  

JetBrains Code With Me entered the Early Access Program (EAP) a couple of months later. I didn’t realise at the time just how central Code With Me would be in my life in the next two years. As Trisha mentions in this blog post, our book Getting to Know IntelliJ IDEA was born at the same time. Given that we were both Java Developer Advocates at JetBrains at the time (Trisha has since left) and working in different countries, we took the most obvious route for book collaboration – Code With Me!

For those of you who don’t know what Code With Me is, the tl;dr is a collaborative programming service. Code With Me allows you to invite others to join you in your IDE, even if they don’t have IntelliJ IDEA installed. Many of you will be familiar with pair programming and you’ve likely done a bit of it in your time. Swarm programming is similar just taking the number of participants to a bigger number than the 1-1 mapping you get in pairing.

Of course with Trisha and myself, we were a pair so no swarming was required. The most common pairing model is where one person navigates and another person drives, but I am getting ahead of myself; back to Code With Me!

The product was in its infancy back then but I’m going to describe the modern-day experience! Let’s start at the beginning, you need the Navigation Bar on to access Code With Me. By the way I’m using the new UI in IntelliJ IDEA because I prefer it. If you haven’t enabled it yet you can do so in IntelliJ IDEA 2022.3 by going to your Settings/Preferences and then searching for “new UI” and enabling it. You’ll need to restart your IDE but then you’ll go from this:

Old Navigation Bar in IntelliJ IDEA

… to this! 

New Navigation Bar in IntelliJ IDEA

However, whatever UI you’re using, the most important icon for today is the Code With Me one:

Code With Me Icon

When you click this, you have three options. We will come back to Start Session in a moment. Permissions allows you to change the permissions that a new session starts with and gives you a finer level of control over what those joining your IDE session can, and of course, can’t do. 

Join Session allows you to join another IDE Code With Me session from your full IDE. It’s worth mentioning again that you don’t need to use your IDE to join someone else’s CWM session, but the option is there.

Back to Start Session, this does exactly what you’d expect. It allows you to initiate a new Code With Me Session, tweak the permissions you want to assign those connecting to your IDE and creates a custom link that you can share with people you want to invite to collaborate. The permissions are grouped into Read-only, Edit Files, Full Access and Custom. For each of these levels you can further define them at a lower level if you want to. For example, I can select Edit Files but then also give them access to run and debug functionality, whereas this is disabled by default with the Edit Files permission set.

Once you’ve settled on the permissions, you can click Start Session. IntelliJ IDEA will copy the link to your clipboard and you can share it with others. Here it is in action:

Once you’ve sent the link over to the people you want to join your session via Slack, JetBrains Space, MS Teams, Twist, Whatsapp, Signal, Telegram or Apple iMessage (did I get them all?) they can paste that link into their browser of choice to initiate the connection The recipient’s machine does not need to have the IDE installed, the guest’s JetBrains client connects to the host’s machine and you’ll be able to work inside their IntelliJ IDEA within the constraints of the permissions the host granted you when they created the Code With Me session.

Trisha and I used Code With Me extensively throughout the creation of our book, Getting to Know IntelliJ IDEA. We loved the fact that you get code completion and the IntelliJ IDEA experience even without the full IDE. We also used the call feature extensively; be aware that Code With Me will mute your audio and turn off your video when anyone else joins the Code With Me session so don’t forget to renable them!

We naturally fell into the pattern of me being the driver and Trisha being the navigator. That meant that I, as the driver would fire up a Code With Me session and send the link over to Trisha, the navigator. However, because we were using Code With Me we weren’t constrainted to this model, we frequently reversed it and I did more talking while Trisha did the editing.

Here you can see the guest on the left and the host on the right-hand side:

Once you’re done collaborating, it’s worth knowing that changes from different authors go into different changelists. This is by design so you can see who has changed what, however, you must remember to drag changes from the contributors into one single changelist if you want to commit them all; IntelliJ IDEA does not allow you to commit multiple changelists (rightly)!

Finally you must close your Code With Me session when you’re finished collaborating. You can do that from the same Code With Me icon and then click End Session, otherwise your friend might come along and leave comments in your code that you weren’t expecting!

Trisha and I covered Code With Me along with lots of other features of IntelliJ IDEA in our book which you can buy directly from Leanpub

Getting to Know IntelliJ IDEA book cover

Getting to Know IntelliJ IDEA Book Launch!

On November 6th 2022, Trisha and I launched our book, Getting to Know IntelliJ IDEA. It’s taken us over two years to write, and it contains a wealth of information; in fact, it contains everything you need to get started using IntelliJ IDEA. We wrote the book because the tools we use matter, and being able to use them effectively improves our productivity and happiness. 

What’s in the book?

The book is over 350 tightly packed A4/US letter-sized pages. The eBook page count, of course, is much larger, at just under 1000 pages… That’s because there are plenty of:

…. annotated screenshots

Annotated screenshot from the book Getting to Know IntelliJ IDEA

… guided tutorials

Tutorial excerpt from the book Getting to Know IntelliJ IDEA

… helpful use cases

Helpful information from the book Getting to Know IntelliJ IDEA

… chapter introductions

Chapter introduction from the book Getting to Know IntelliJ IDEA

… chapter summaries

Bottom Line from the book Getting to Know IntelliJ IDEA

… and that’s before we get started on the Trisha Tips

Trisha Tip from the book Getting to Know IntelliJ IDEA

… and Helen Hints:

Helen Hint from the book Getting to Know IntelliJ IDEA

… plus much more!

How is the book structured?

The book is split into four parts, each of which has a different goal so that you can either read the book front to back, which I recommend if you’re new to IntelliJ IDEA, or you can dip in and out as you need to which more experienced users may want to do.


Part I lays the foundations of what IntelliJ IDEA is, what the key elements of the interface are, and how you can get the most from them. It also introduces the three guiding principles for IntelliJ IDEA:

  • Always Green – IntelliJ IDEA strives to keep your code compiling by flagging errors as they happen and assisting with keeping it syntactically correct.
  • Keyboard First – Using IntelliJ IDEA’s keyboard shortcuts speeds you up in your day-to-day tasks. You probably won’t learn them all, but learning the ones you use helps keep you focused.
  • In the Flow – We all know the feeling when you’re happily coding and don’t want distractions; we have provided lots of tips and tricks to help you stay in this zone while using IntelliJ IDEA.

Part II builds on the foundations laid in Part I for writing and reading code, which is a huge part of our daily jobs. It introduces some key features that help do the heavy lifting in IntelliJ IDEA so you can focus on doing what you do best – figuring out solutions to problems! There are many opportunities for you to try stuff out with the code snippets we have provided, which are all available on GitHub.


Part III takes it to the next level and uses guided tutorials to show you how to open, run, test, and debug real applications. These tutorials get you up and running quickly and introduce you to IntelliJ IDEA’s features so you can explore them at your own pace. Part III also discusses working with dependencies, build tools and version control; central components for real-world applications.


Part IV is where the book pivots to specific functionality you can use in your day-to-day workflow. This is where you can discover areas of IntelliJ IDEA that you might not be familiar with. We’ve included many features that can support you and introduced the “Frequently Asked Questions” element to answer your questions. The Table of Contents gives you clues as to what’s in here!

Header 1 Header 2 Header 3
IntelliJ IDEA essentials

Fixing errors and warnings

Refactoring your code

Formatting and rearranging your code Benefiting from multiple clipboards Using Run configurations effectively
Diving into debugging Expanding on testing Building on build tools
Doing more with dependencies Making version control work for you Viewing and applying local history
Running commands in the terminal Managing work todos Pairing with code with me
Working with plugins Understanding Java in IntelliJ IDEA Looking in your .idea folder
Changing IntelliJ IDEA settings What to do when things go wrong  

Where do I find out more?

You can check out Getting to Know IntelliJ IDEA today and learn how to get the most from your IDE!

Header 1