Announcement

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

  • What is the point of this recent do file editor change

    In the 18dec2024update to StataNow, this change was made:

    Do-file Editor current word and selection highlighting. The Do-file Editor will now highlight all case-insensitive occurrences of the current word under the cursor. It will also separately highlight all case-sensitive occurrences of the current selection. These features can be disabled in the Do-file Editor preferences dialog.

    Personally I hate this change. When a word is highlighted I feel like I have selected it and expect to be able to replace it with something else instead, but that actually takes more steps.

    In other words, highlighting usually means I have selected a word (perhaps by double-clicking it). But, now it just means my cursor is under the word and every other occurrence of the word gets highlighted too.

    I figured out how to disable the feature. But is it actually something incredibly useful that I just don't appreciate the value of? I assume the change was made for a reason but I don't know what the reason is.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

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

  • #2
    Is it very useful for everyone? No, though it has its uses. The feature sounds identical to what can be found in other advanced text editors (my favourites being Sublime Text and Notepad++).

    Here's the situation I have used this. Suppose have a program I am developing where I have hardcoded some variable name. Later I decide that I want to change/rename that variable. Or I have used a macro and want to rename it everywhere I've used it. I can achieve the same end result using a Find/Replace All, but that doesn't show me where those changes may occur. If I can correctly highlight (with or without case-sensitivity) I can know if I might adversely affect some other piece or code or text in a comment.

    Comment


    • #3
      Seconded in full. I am also wondering who would possibly want this feature.

      Comment


      • #4
        I'd rather Stata integrates some of the useful features from other text editors. I've cut it all off.

        Comment


        • #5
          I sometimes use VS Code, which has a similar feature, but implemented better, in my opinion.

          The highlighting does not happen as you are typing, and so it is not distracting as described in #1. But when you take your cursor to a word, it highlights all its other occurrences, serving the purpose described in #2. The current implementation has made me just switch it off in Stata, while I have never had issues with the way it is done in VS Code.
          Last edited by Hemanshu Kumar; 28 Jan 2025, 10:46.

          Comment


          • #6
            We got many requests for this feature which is why it was included. However, when I first installed VS Code a while back, word highlighting was one of the first things I turned off because I found it too distracting. What I find more useful is the selection highlighting. I was not aware VS Code doesn't highlight while typing so we'll have to look into that. Other editors handle word highlighting a little more elegantly than even VS Code as they'll only highlight words that are variables instead of everything. We'll be adding options to not highlight matching words in strings, comments, etc. in the future.

            We enabled the feature by default because not everyone reads the what's new for updates so most users would not have been aware the feature is available and turning off the feature is easy.
            -Chinh Nguyen

            Comment


            • #7
              Thanks Chinh. The explanation in what’s new might be even more explicit on how you turn it off, I.e. what box do you check or uncheck?

              When a new feature like this is introduced, I think it may be better to leave the status quo the default since it took me a while to figure out why things had changed.
              -------------------------------------------
              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
                How do I turn this feature off? Thanks.

                Comment


                • #9
                  On Windows it goes like this:
                  1. Open the do-file editor.
                  2. Open the Edit drop-down menu and select Preferences.
                  3. Chose the General tab.
                  4. Look for the options "Highlight matches to the current word" and "Highlight matches to the current selection." These are two separate features. You can disable each of them by unchecking the associated box. You might want to disable both, or just one--your preference.
                  5. Click Apply and then OK (at the bottom of the Do-file Editor preferences window).
                  I'm sure it's a very similar process on Mac or Unix, though the details may differ slightly.

                  Comment


                  • #10
                    Je vous remercie!

                    Comment

                    Working...
                    X