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.
To collapse or expand all code fragments, press Ctrl+Shift+NumPad - / Ctrl+Shift+NumPad + . PyCharm collapses or expands all fragments within the selection, or, if nothing is selected, all fragments in the current file, for example, all methods in a file.
Key board short cut : Hold down ctrl shift - to collapse them all.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With