Matching IF - ENDIF with lines

Matching IF - ENDIF with lines

4
NewbieNewbie
4

    Aug 06, 2008#1

    There's an official word for lines that are in the left margin of code that match an IF with the appropriate ENDIF.
    Whatever that is, is there a way to do this with UltraEdit?

    6,605548
    Grand MasterGrand Master
    6,605548

      Aug 06, 2008#2

      Are you talking about preprocessor directives or statements/keywords? In some languages IF - ENDIF are statements/keywords, in other languages these are preprocessor directives.

      However, you can use Search - Match Brace to find the matching statement/keyword/directive. You just have to add these 2 words to the list of open and close brace strings in your syntax highlighting wordfile for the language used to highlight your source files.

      Open Advanced - Configuration - Editor Display - Syntax Highlighting and press the button Open right to the file name of the syntax highlighting wordfile you currently use, if you don't have open a project with a project specific wordfile. Close the configuration dialog with button Cancel.

      Find the line which starts with /Lx"..." with x is a number in the range of 1 ... 20 and "..." is the name of the language you see in the status bar at bottom of the UltraEdit window or in menu View - View As (Highlighting File Type) when one of your source file is the active file.

      Between this language definition line and the line starting with /C1 you should see something like following:

      /Open Brace Strings = "{" "(" "["
      /Close Brace Strings = "}" ")" "]"


      If you can't see these lines, insert them above the line starting with /C1. Next modify it to:

      /Open Brace Strings = "{" "(" "[" "IF"
      /Close Brace Strings = "}" ")" "]" "ENDIF"

      Save the wordfile and you can immediately test, if command match brace now works for IF - ENDIF too.

      Additionally I suggest to specify IF and ENDIF also as code folding keywords.

      /Open Fold Strings = "IF"
      /Close Fold Strings = "ENDIF"


      or maybe even better

      /Open Fold Strings = "IF" "ELSE"
      /Close Fold Strings = "ELSE" "ENDIF"


      Now you can easily fold (make hidden) all lines between matching IF - ELSE, ELSE - ENDIF and IF - ENDIF statements/keywords/directives.

      For more details see in help of UltraEdit the page about syntax highlighting and the readme topic in the syntax highlighting forum.
      Best regards from an UC/UE/UES for Windows user from Austria

      236
      MasterMaster
      236

        Aug 06, 2008#3

        Perhaps what he means is to have fold regions marked by a line in the left margin, like this:

        002_Ausschnitt.png (12.19KiB)

        I don't think that's possible with UE.

        4
        NewbieNewbie
        4

          Aug 06, 2008#4

          pietzcker -
          That's exactly what I am looking for. It would be GREAT if UE would have this option with the ability to print.
          For very lengthy programs it would be a life-saver.

          Considering that UE can help identify matches already, the addition of a line to the left that is printable seems doable...

          I'm really surprised that no one has done this yet.

          1
          NewbieNewbie
          1

            Sep 04, 2008#5

            I'm also looking for a way to highlight syntax matches for HTML tags. Folding is useful in some cases but most of the time I just want to see highlighted text

            In wordfile.txt, In the section that starts with,

            /L3"HTML" HTML_LANG

            I added,

            /Open Brace Strings = "{" "(" "[" "<div"
            /Close Brace Strings = "}" ")" "]" "</div"

            Auto syntax highlighting is turned on.

            4
            NewbieNewbie
            4

              Jul 21, 2009#6

              New version 15.10 -
              Cool stuff, but disappointment when it comes to IF/THEN (logic) "staples". (see pietzcker above)
              I can collapse code, yes. But I can not visually see nested loop lines - I have notches, but they do not indicate which IF matches an ENDIF.
              Not only that, but it still doesn't print!!
              Please, please consider giving us a more robust logic staples that actually match & print....

              7

                Jul 24, 2009#7

                It would be really great if folded code could have the option of having the entire line highlighted so that it is not so easy to delete the folded code.