Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Code folding help

    Help wanted · · · – – – · · ·
    2
    5
    155
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Vindicit
      Vindicit last edited by

      So Im trying to use code folding. I’m not sure what language I am working with so I am trying to create my own language setting. My open line in the code looks like “Macro XXXXXXX” my end code is just “End”. So my open fold is just “Macro”.

      |Macro XXXXXX
      |mid
      |mid
      |End

      The issue I’m having is within the code there is “Attribute End” and “End Object” which is hanging up the end fold. How do I specify my closing fold as just “End” by itself with a new line afterwards?

      PeterJones 1 Reply Last reply Reply Quote 0
      • PeterJones
        PeterJones @Vindicit last edited by

        @vindicit ,

        Unfortunately, as far as I know, you cannot do that by itself.

        The logic for determining the folding is pretty simple, and cannot handle restricted cases such as that. (It was more designed with simple pairs like if / endif in mind, where there is no ambiguity.)

        However, if you can nest something like "attribute begin" / "attribute end" inside, then you could set
        OPEN = "attribute begin" macro
        CLOSE = "attribute end" end
        then this text

        blah
        
        macro
        
        attribute begin
        
        attribute end
        
        end
        
        blah
        

        will fold as:
        b12035ea-9e9d-4a98-99e6-f172110c1dab-image.png
        … so the attribute begin / attribute end is a nested fold inside of the other

        But that requires that anything with “end” in it be able to be added in the list (and the one that’s just-plain-“end” has to be the last version in the list).

        1 Reply Last reply Reply Quote 0
        • Vindicit
          Vindicit last edited by

          Thanks Ill take a look at that.

          1 Reply Last reply Reply Quote 0
          • Vindicit
            Vindicit last edited by Vindicit

            So I took a look at the code and it has as an example

            Macro XXXXX
            
            Begin Object XXX
            
            Attributes Beg
            Attributes End
            
            End Object XXX
            End
            

            So In the folding in code 2 style I have
            Macro “Begin Object” “Attributes Beg”

            In close I have
            “End Object” “Attributes End” End

            Does this look right? It seems to work.

            PeterJones 1 Reply Last reply Reply Quote 0
            • PeterJones
              PeterJones @Vindicit last edited by

              @vindicit ,

              If it works for you, that’s the important thing. I always keep the pairs in the same order, so I would have said OPEN = "begin object" "attributes beg" macro and CLOSE = "end object" "attributes end" end so that the object-pair were the first tokens in each, the attributes-pair were the second tokens in each, and the macro-pair were the third tokens in each. But that doesn’t seem to be required.

              1 Reply Last reply Reply Quote 1
              • First post
                Last post
              Copyright © 2014 NodeBB Forums | Contributors