66

Is it possible to expand the entire project tree in Intellij? I would like to do this so I can more easily search the structure and jump back and forth between files and folders.

I know of double shift, and CTRL+SHIFT+N, but that is not what I am after.

Michele Dorigatti
  • 616
  • 1
  • 5
  • 15
mmm
  • 18,431
  • 26
  • 99
  • 165

7 Answers7

131

There is a Fully Expand Tree Node action, which is bound to Numpad * key (*) by default.

But if you use this key, it doesn't expand the whole tree, rather it expands the first level and when you press it again it expands subsequent levels, and so on.

But it can still do what you're trying to achieve. Just click the tree item you want to expand (for example src) in project view, press and hold the * key and all nodes will be expanded pretty quickly. It's not the best way but I'm not aware of any better solution.

Tested on IntelliJ IDEA 14 and 2019.3.3 Ultimate

If you press *: Expand 1 level.

If you press * *: Expand 2 levels.

If you press * * *: Expand 3 levels.

and so on.

Samuel Liew
  • 68,352
  • 105
  • 140
  • 225
Bohuslav Burghardt
  • 29,945
  • 7
  • 98
  • 104
  • 5
    Works in the **Find Occurrences** view in PyCharm as well. `*` = recursively expand node and all subnodes. `-` = recursively collapse node and all subnodes. `+` = expand node and apparently several levels of subnodes. – Mat Gessel Nov 20 '15 at 18:46
  • 9
    Numpad binding is not very useful for my Macbook. But knowing the command helped. I assigned to Ctrl-Cmd-E, since that's not taken in default bindings. – SilverSideDown Jun 07 '16 at 13:38
  • 1
    Works on PyCharm 2016.1 – Christian Long Jun 15 '16 at 16:28
  • Thank you so much! This bugged me for ages. – Thomas Mohr Aug 29 '17 at 11:07
  • Be careful of key binding conflicts. This wasn't working for me at first because of some overlap with the OSX default keybindings for code folding and for diagram zoom in and out. Make sure to try editing the shortcut to see if any conflicts. – Ken Colton May 15 '18 at 15:36
  • for mac users, this action is disabled. double click shift, search for this action , press `options+return` and bind it to a shortcut of your choice (I use `shift + *`) – ansh sachdeva Nov 28 '20 at 22:37
29

You can use right-arrow button to expand the selected node,and keep pressing to expand all node.

Or

Search "Fully Expand Tree Node" in settings->Keymap,find the keyshort,use it,it will expand nodes level by level.The other two command within Others is not useful.

And you can also set mouse shortcut like "ALT+[Wheel Down]",this can help you expand all without one hand leaving the mouse. More efficient,you can Set "Collapse Node" keyshort to "ALT+[Wheel Up]".

zwx
  • 439
  • 5
  • 7
  • 1
    "Fully Expand Tree Node" is the winner. Mouse binding is clever. I actually almost never use those. One thing that tripped me up was that some of the default bindings were overlapping with code folding and diagram zoom in and out. Just a heads up for anyone else since it's not easy to see the conflicts without editing. – Ken Colton May 15 '18 at 15:34
21

Now, you can expand the entire directory structure in IntelliJ. All you need to do is to select the project in project explorer and hold Right Arrow button. It will expand all the files in that project.

unknownerror
  • 1,755
  • 1
  • 18
  • 21
  • 2
    It's also worth noting that Left Arrow will conveniently collapse the project structure from whichever node is selected (in 2017.3). – skomisa Dec 11 '17 at 17:08
  • 2
    This action does not expand all sub-folders recursively. I think OP's question was to expand ALL folders. – Harish Oct 22 '18 at 18:41
4

I use a simple approach. In my Mac, I've set a key map.

Using only Right Arrow expands folder (but sub-folders are not expanded).

So I've set a key map in Fully Expand Tree Node to CMD+Right Arrow to expand selected folder and all its sub-folders fully. To close/collapse it, simply use Left Arrow.

Harish
  • 478
  • 6
  • 16
4

Without setting keymap

If you think you won't use this feature often, I'd rather go with just selecting the folder you want to fully expand, pressing double shift and search for "Fully Expand Tree Node".

how search look like

Andras Kloczl
  • 7,710
  • 2
  • 16
  • 22
3

I'm using v14. The title bar>Settings(icon) has an AutoScroll from Source option which, if checked, drops down the subordinate files in the tree. Is this what you are looking for? HTH

2
  1. Go to File > Settings/Preferences
  2. Select Keymap
  3. In the search dialog search for "Fully Expand Tree Node". You will find the shortcut used for it.

To create your own keyboard shortcut for it:

  1. Right-click on the item you found in step 3 mentioned above and select Add Keyboard Shortcut
  2. On the Keyboard Shortcut dialog, press your desired shortcut keys (for example Alt + E).
  3. If it is not already assigned, save your changes and select the folder you want to extend and press the shortcut you created.

enter image description here

Lamiaa Elmorsy
  • 329
  • 3
  • 9