📁 VS Code Tip: Use "Explorer: Compact Folders" for Cleaner File Trees

Forhad HossainForhad Hossain
1 min read

If you're working with deeply nested folder structures—like Java package hierarchies or modular apps—your file explorer in VS Code can quickly get cluttered. Thankfully, there's a simple setting to make it tidier: Explorer: Compact Folders.

🌳 What It Does

When enabled, this setting compresses folders that contain only a single child folder into a single combined element in the Explorer view. Instead of seeing:

src/
  com/
    example/
      myapp/

You'll see:

src/com/example/myapp/

This compact form is not only cleaner but also helps you navigate your project faster by reducing unnecessary folder clicks.

⚙️ How to Enable It

  1. Open Settings (Ctrl + , or Cmd + , on macOS).

  2. Search for “Compact Folders”.

  3. Check or uncheck Explorer › Compact Folders based on your preference.

You can also set it directly in settings.json:

"explorer.compactFolders": true

✅ When to Use

  • ✔️ Great for Java, Angular, or monorepo-style structures.

  • ✔️ Helps when you're browsing unfamiliar codebases.

  • ❌ Not ideal if you prefer seeing every folder explicitly.

Give it a try and see how much neater your Explorer becomes!

0
Subscribe to my newsletter

Read articles from Forhad Hossain directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Forhad Hossain
Forhad Hossain

Hi, I'm Farhad Hossain, a passionate web developer on a journey to build impactful software and solve real-world problems. I share coding tips, tutorials, and my growth experiences to inspire others.