As a quick workaround, I would suggest disabling #region/#endregion outlining in Tools/Options/Text Editor/PHP/Advanced.

We're looking into it.

    It seems this only happens if you open .php files without having a project/solution.

    Without a solution, Visual Studio doesn't save the outlining state and doesn't restore it properly after reopening the file. Since #region is collapsed by default, Visual Studio always collapses it.

    Also, without a project/solution, most of the features just won't work.

    Is this the case?


    In this case,

    • it's always better to use projects or open a folder (File / Open / Folder)
    • don't delete .vs directory created by Visual Studio - it contains the region's collapsed state
    • or eventually, we can create an option to not collapse #region by default

      The project is opened using the start window through an .sln solution file. (*.sln)
      The .vs directory is intact.

      Still collapses automatically.

        jeHawWebdesign

        I guess, the .php file is a part of the project?

        I can't repro the issue, but I can change the defaults, so region won't get collapsed implicitly - will be done or configurable in next update.

          5 days later

          JakubMisek Sorry for the late reply, things got very hectic for the last few days. Many thanks, appreciate the effort.

            jeHawWebdesign Thank you for the reply, I hope everything is OK.

            I'll prepare a new update soon, it won't collapse #region by default.

              13 days later

              It works, too well. After setting it to false:

              If all regions are collapsed and I open one region to work on it, then either close the file and then open it or close VS and then restart it, all regions are expanded.

              Thanks for trying though.

              The offending VS update (17.9.0) has caused a lot more problems than just this, interface changes without justification, collapsed TypeScript / JavaScript regions not showing tags, etc., they really did a job on this one.

                jeHawWebdesign At least, we expand the regions by default, so you can see the code :) although, as you said, this needs to be handled by VS (fixed in a future update of VS). In some cases, it just forgets the state of the regions.

                  15 days later

                  I tried deleting that last post. It worked for all of one session. The moment I closed VS and reopened it later, the problem had returned.

                    2 months later

                    JakubMisek Just a heads up, this one is going back to the Development Team tomorrow.

                    I'm not sure if you are aware of the big shit storm that has been brewing over the new collapse symbols they introduced in v.17.9. Here it is if you missed it:

                    "Outlining in 17.9 uses ugly "v" for collapse/expand instead of the previous "+" with a box. We have no option to restore things to how they should be."

                    https://developercommunity.visualstudio.com/t/Outlining-in-179-uses-ugly-v-for-coll/10584634#T-ND10677516

                    Once of the people got tired of waiting on Microsoft and their complete disregard for the concerns of the community and coded a plugin that is available in the Visual Studio Store yesterday. I downloaded it today and installed it, and guess what?

                    95% of the problem has disappeared!

                    When I close VS down and reopen it later, or load another project and then reload the current project, the expanded regions are still expanded and the closed regions are still closed.

                    This tells me that the problem is with their new and "wonderful" implementation for collapsing regions.

                    Of course, with how the MS development team completely ignored the above problem in the first place, I am not hoping form much, but it's worth a shot.

                    I just wanted to update this and will keep you posted.

                    jeHawWebdesign Thank you for the update, I was not aware.

                    I understand they must maintain tons of legacy functionality while bringing new features. The v is probably an attempt to unify UI with VS Code and other IDE's ...

                    Anyways, I'm glad regions are working better now. If there is anything we could do to improve, please feel free to let us know.

                      Write a Reply...