Save state of code folding with manually changed parts of code
Is there a way that IDE save the states of elements which have been expanded / collapsed by me? Right now each time I open my project all code is expanded by default even if some methods were collapsed by me manually. I know that I can change default behaviour, but what I need is to keep state of some methods when I open that file again or relaunch my project.
Please sign in to leave a comment.
Hi there,
What kind of code (language) is that?
It works for me -- as long as I close the project and that file is opened at that time.
Sometimes (some files) it works even if I close such file between sessions ( I mean: collapse, close file, restart IDE, project opened but that file is closed; open that file and collapsed state is remembered). Support team says that it should work all the time (well, at least for recently used files for sure).
Are those actual project files .. or perhaps scratch files / file is outside of the project (excluded folder etc)?
IDE version? Have you tried with custom plugins disabled (sometimes they may interfere)?
I don't know what happened, but today when I updated from 2018.2.1 to 2018.2.2 it started to work normally. I had got problem with unit test classes and each time I had to collapse all set up methods. I tested it 4 times yesterday. I haven't noticed such problem before. It seems to work fine now.
I found the source of "problem", however I don't know if it is correct behaviour. Your code will expand when you switch to another branch and there are some changes in file between branches.
In my case I have got unit test class which was modified on feature branch. After tests I collapsed all methods because they are very long.
Then switched back to develop branch. For 5 seconds I can see following view:
After 5 seconds method setUp has been collapsed but another method became expanded
However I don't know why setUp method expands and then collapses itself as there were also changes made.
Was there a resolution to this?
I'm considering investigating what it would take for writing a plugin to handle the following:
//++ Test Harness
//---
To have the enclosed region auto folded with a Tag of "Test Harness" (or whatever string) show up in the editor. I have no idea why Java went through all that effort to put in a pseudo standard of /** for javadoc but didn't consider the necessity of folding. IDEs (and vi/emacs/sublime) would have followed suit.
Similarly, the text "Test Harness" could show up vertically on edge on the left when the region is unfolded.
I checked that behaviour on phpStorm 2018.3.5 and I wasn't able to reproduce above issue on another class, so it could be already fixed. I can do a check on the same class as I presented in my example if you need this.
Can some one let me know if there is a feature to save the state of manually folding? Its a pain in the ass that everytime a file is closed the folding needs redo.
I would also like this.