I have seen this question but if I apply the Ctrl+Shift+- shortcut it collapses everything including class
, method
, doc
, if/try-catch/foreach
etc. Basically every block within curly braces are folded which makes it a p.i.t.a to view code. I want to reduce the visual clutter, so what I would like to see is only the method and doc blocks collapsed, so that I can quickly navigate to method and inspect code from thereon.
After spending some time with the IDE I figured it out for myself. One can do Ctrl+Shift+- and then Ctrl+Shift++. Basically the first shortcut action collapses everything and the second action expands everything but method definitions and doc blocks. If you apply Ctrl+Shift++ a second time then PhpStorm expands everything including methods and docs.
This can be effected from the menu (without shortcuts) using mouse with the following steps:
1. Menu -> Code -> Folding -> Expand all to level -> 5
2. Menu -> Code -> Folding -> Expand all to level -> 1
This does the reverse operation of the first method, i.e. first expands everything and then collapses just methods and docs, but the effect is the same.
I use NetBeans keymap scheme, so things might be slightly different at your side, but the idea is the same.
The accepted answer does not seem to work any more.
Instead, after you have collapsed all (Shift+Command (⌘)+-), you can then hold Command (⌘) and click on the '+' code folding toggle to the left of the editor to recursively expand the whole folded region.
P.S. Sorry the shortcut keys are for mac, not sure what the windows shortcuts are.
© 2022 - 2024 — McMap. All rights reserved.