Announcement

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

  • Do-file editor language color schemes

    Has anyone tried these (in Stata 16) yet? I am finding they do not work like I think they should.

    For instance in a document where I have selected the Markdown color scheme, text that is marked as a Header does *not* show up as a Custom blue (the default). When I try changing the language to something else and then changing back to markdown, I get varying results - different color schemes that I sometimes can and sometimes can't reproduce.

    Please tell me it is not just me!
    Doug Hemken
    SSCC, Univ. of Wisc.-Madison

  • #2
    I just tried this. When I change the language to Markdown, it converts the color of the comment to that Custom blue. I also tried modifying that Header color in the preferences to hot pink, and changed the language again to Markdown, and it now displays it in hot pink. I tried switching languages, and it works on my end. What is your current update level? Mine is 01 Aug 2019.

    Comment


    • #3
      Thanks for the feedback - that's not at all what I see. I'll have to come up with some pictures.
      Doug Hemken
      SSCC, Univ. of Wisc.-Madison

      Comment


      • #4
        So partly, coloration does not work as I expected, and partly it is just weird.

        When it works, markdown coloration/highlighting adds color to some inline elements, in some block contexts. For block elements, we have color coding for code blocks, but color coding for the block element markers only for most block elements. (With my poor eyesight, I missed a lot of this last part the first time.)
        Click image for larger version

Name:	Example_txt correct.PNG
Views:	5
Size:	39.7 KB
ID:	1511548




        Notice that inline elements don't highlight in headers (they are compiled correctly, though), but do highlight in lists.

        The weirdness comes when selecting a language highlighting scheme. Files with a "md" extension that are opened in the editor are autodetected, as expected. But when starting a new file, if you manually select the language after you have begun typing you get
        Click image for larger version

Name:	Example_txt manual1.PNG
Views:	3
Size:	39.0 KB
ID:	1511550




        or
        Click image for larger version

Name:	Example_txt manual2.PNG
Views:	3
Size:	38.1 KB
ID:	1511551




        Once you start typing, the text from where you are typing to the end of the file changes to markdown highlighting - not the whole file!
        Click image for larger version

Name:	Example_txt edit2.PNG
Views:	1
Size:	38.4 KB
ID:	1511552




        So I guess everything works ... in it's own way.

        (Sorry about all the images below - clearly I don't understand how to use this platform.)
        Attached Files
        Last edited by Doug Hemken; 09 Aug 2019, 06:17.
        Doug Hemken
        SSCC, Univ. of Wisc.-Madison

        Comment


        • #5
          We're looking into this. I believe the problem is that Stata for Windows isn't recoloring the entire document after you've switched the language.
          -Chinh Nguyen

          Comment


          • #6
            It recolors twice. Once (completely wrong) when the language is switched - this really confused me. Then it recolors from any edit to the end of the document, which is just odd behavior. I could make a little video if that would help.

            And I'd like to see a consistent style of highlighting - either full elements, or just the markers, not a mix of the two.
            Doug Hemken
            SSCC, Univ. of Wisc.-Madison

            Comment


            • #7
              It's resetting what's called the style when you switch the language. It's then supposed to recolor the whole document but it's not so what you see as a recolor is just the document in an incomplete state. The style has been changed so any new edits will use the new style. Like I said, we just need to recolor the whole document after a language change.
              -Chinh Nguyen

              Comment


              • #8
                Originally posted by Doug Hemken View Post
                And I'd like to see a consistent style of highlighting - either full elements, or just the markers, not a mix of the two.
                Just to be clear, you're saying that the line # Markdown *Elements* should be in one color right?

                This is how the Markdown syntax highlighter we use behaves. I also looked at a few third party editors (Visual Studio, Xcode, BBEdit, Sublime) and that's how they behave too.
                -Chinh Nguyen

                Comment


                • #9
                  That would be one option, but not everyone would like that.

                  For inline elements, I would expect strikethroughs and autolinks to have color coding. And I would expect the color coding to show up inside any block element that accept inline elements (headers, lists, blockquotes).

                  For block elements, I can see that highlighting the whole block would be a lot of distracting color. On the other hand, it wasn't until Cyrus pointed it out to me that I even saw some of it (plus I was confused by the language switch phenomenon). And I can see that code blocks can be a special case (because they are sometimes marked by indentation, i.e. white space); and tables might be complicated. So I'm not really sure what to tell you there - I don't see an obvious, consistent way of doing things.
                  Doug Hemken
                  SSCC, Univ. of Wisc.-Madison

                  Comment

                  Working...
                  X