Explain Codes LogoExplain Codes Logo

How to Expand Folded Package Chain in IntelliJ IDEA?

java
intellij-idea
package-management
project-structure
Nikita BarsukovbyNikita Barsukov·Feb 17, 2025
TLDR

Expand all packages in IntelliJ IDEA:

  • Windows/Linux: Ctrl + NumPad +
  • macOS: + NumPad +

To expand a specific package:

  • Right-click, select Expand
  • Shortcut: Alt + Right Arrow (Windows/Linux), + Right Arrow (macOS)

For individual packages: Click the arrow icon next to the package name.

Directory Structure: Control your View

Need full control of your package structure due to complex hierarchies or organizational preferences? Un-check "Hide Empty Middle Packages" in the Project View settings for maximum control over your directories.

Tailoring your Package View

Flipping the Switch: Package View

A temporary solution to alter the package display is to right-click on the project tab and select "Compact Middle Packages". This will toggle between chained and detailed view.

Avoiding the Chain: Permanent Solution

For a more permanent solution, disable the "Flatten Packages" option in the settings. This will prevent IntelliJ from automatically chaining your packages.

// Hey IntelliJ, stop "flattening" my packages! // Coffee for human, flat packages for robots

Visualization

In the locked state, you can see only the top of the package chain, like a closed book 📕.

Folded (🔒): - src - main - java (🔒)

To expand the package chain is like opening the book and reading its chapters one by one📖.

Expanded (🔓) -src -main -java (🔓) -com -example -myapp

"Unzipping" the chain reveals the hidden contents, like you’ve found a secret treasure chest! 🥳

📕🔒 -> 📖🔓 // It's not magic, just a bit of clicking!

Extended Package Management

Package Explorer: Your Guide

The Project View tab in IntelliJ is your directory guide. It's crucial to understand how to navigate and manipulate it for a more efficient workflow.

Versions Matter: Different UX

IntelliJ evolves with every update. For example, in IntelliJ IDEA 2021.3.2, there may be some settings located differently compared to other versions. Stay updated!

Words vs. World: Understanding over Brevity

A clear, detailed view of your packages can simplify navigation and reduce errors. A fully-expanded package overview often works better than a fancy but confusing, compact view.