How to enable "Collapse all" in "Structure" (File) context?

Hi,

when opening a php or js file, there's a "structure" window in PhpStorm where all classes, functions and variables are listed.

How to set it up to always collapse/fold the listing? Actually, when I open a file, the structure is always expanded. To browse in that file, I always have to hit the "Collapse All" button.

Any chance to have it collapsed by default somehow?

2

Hi there,

I personally not aware of any option that would do that.

Related tickets:

0

https://youtrack.jetbrains.com/issue/IDEA-82694

LOL, this is so freakin old... why isn't it fixed/implemented yet?

...

0

No solid idea.

Note from the side:

  • The structure gets rebuilt when you add new element (e.g. new method/new class) or making big modifications in a file (e.g. copy-paste big chunks)
  • You can use Structure panel even for files that are currently not opened (in the editor) .. but selected in the Project View panel
  • There are not many votes for that ticket ... which could mean that issue is not so critical (or people get used to this behaviour that they do not mind it too much)

Quite possibly these top 2 have something to do with the way how Structure panel works (at very least that is my understanding based on dev comments on this subject that I have seen over years (I'm PhpStorm/Issue Tracker user since PhpStorm v0.6 or so .. so I have seen quite large number or tickets overall). Those are two tickets that I think were most relevant out of all results for https://youtrack.jetbrains.com/issues/IDEA?q=structure%20collapse%20by%20default -- maybe you will do a better search.

P.S. https://youtrack.jetbrains.com/issue/IDEA-24085

0

I think the ask here is to support at least 1 of these features:

1. Have a setting something like "open all source files (Python, PHP, JSON, etc) collapsed."

2. Have a setting for each file type something like

         "open all Python source files collapsed. <checkbox>"

         "open all JSON files collapsed. <checkbox>"

         "open all PHP source files collapsed. <checkbox>"

3. Remember the last setting for each file and restore that each time the file is opened.

NOTE that when/if you add this feature you could consider taking a leap ahead:    - instead of a checkbox use a level number (say "n") for each option.  By this I mean that you could have each object expand only n levels when opened.  If the value entered is 1, then each object would be expanded just 1 level but levels 2+ will be collapsed.  If "2" is entered, then all objects would be expanded 2 levels and the remaining 3+ levels would be collapsed.

 

 

 

 

 

 

 

0

请先登录再写评论。