Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Code folding

    In preferences, I do not see a "fold all" option to fold all code in a do file. It used to be there.

  • #2
    The version is 18 SE.

    Comment


    • #3
      In do file editor preferences, under advanced, I see fold all code blocks when opening a do file. Do you not see that, or is that not what you want?

      I also see view/cold folding/fold all.

      Make sure your copy of Stata is up to date.

      update all
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      StataNow Version: 19.5 MP (2 processor)

      EMAIL: [email protected]
      WWW: https://www3.nd.edu/~rwilliam

      Comment


      • #4
        Thanks for your reply Richard. I just updated Stata. I do not see any of these. Looks odd.

        Comment


        • #5
          This is what I see:
          Attached Files
          Last edited by Tunga Kantarci; 12 Apr 2025, 16:10.

          Comment


          • #6
            You're showing the Preferences menu. On my machine (Windows), the Fold all menu option is on the Do-file editor's View menu tab and not the Preferences.

            So, as Richard mentions above: from the Do-file editor's main window → View menu tab → Cold foldingFold all.

            Comment


            • #7
              However, in my do file preferences,
              Click image for larger version

Name:	Screenshot 2025-04-12 194753.png
Views:	1
Size:	52.9 KB
ID:	1775907



              So, my Do file preferences do include a fold all code blocks option. But Tunga's do not.
              Last edited by Richard Williams; 12 Apr 2025, 17:57.
              -------------------------------------------
              Richard Williams, Notre Dame Dept of Sociology
              StataNow Version: 19.5 MP (2 processor)

              EMAIL: [email protected]
              WWW: https://www3.nd.edu/~rwilliam

              Comment


              • #8
                Were you using StataNow 18.5 before? This excerpt from whatsnew suggests that statanow 18.5 had cold folding enhancements but not stata 18.

                9. (StataNow) Do-file Editor enhancements. The Do-file Editor has the following additions:

                a. Code folding enhancements. Code folding allows you to selectively hide parts of a document so that you can focus on sections of interest. Stata’s Do-file Editor allows you to selectively fold blocks of code in a do-file such as programs,
                Mata code, Python code, functions, and if statements by collapsing them to a single line. You can now quickly fold all foldable blocks of code in your do-file by using the Fold all menu item.
                Last edited by Richard Williams; 12 Apr 2025, 18:05.
                -------------------------------------------
                Richard Williams, Notre Dame Dept of Sociology
                StataNow Version: 19.5 MP (2 processor)

                EMAIL: [email protected]
                WWW: https://www3.nd.edu/~rwilliam

                Comment


                • #9
                  Version is Stata/SE 18.0 for Mac (Intel 64-bit). What I do not understand is this used to work fine until I installed this version. I used to fold the code with no problems and I do recall that fold all option was there. When I go to Vie and then do file editor, under code folding, all I see is Toggle and unfold all. Something fishy is going on here.

                  Comment


                  • #10
                    Maybe it is a bug in the Mac Version. I would contact Stata Tech support.
                    -------------------------------------------
                    Richard Williams, Notre Dame Dept of Sociology
                    StataNow Version: 19.5 MP (2 processor)

                    EMAIL: [email protected]
                    WWW: https://www3.nd.edu/~rwilliam

                    Comment


                    • #11
                      I will. Thank you very much for all the attention and replies.

                      Comment


                      • #12
                        Originally posted by Tunga Kantarci View Post
                        In preferences, I do not see a "fold all" option to fold all code in a do file. It used to be there.
                        I believe this is just a StataNow 18 feature. It's available in both Stata 19 and StataNow 19.
                        -Chinh Nguyen

                        Comment


                        • #13
                          I took another look at this since you said you lost the feature after update and there was no trace of that feature in the last couple of updates to Stata 18. I didn't realize you must not have updated in quite some time because I found that the feature had been added to Stata 18 about a year ago and was mistakenly removed in the following update possibly when StataNow was released. We will add the feature back in an update.
                          -Chinh Nguyen

                          Comment

                          Working...
                          X