Help with setting up "Folding" in UDL2

Davey
2013-06-11
2013-12-02
  • Davey

    Davey - 2013-06-11

    Hi,
    I code mostly in a language specific for a program that I use.
    Its if/for/while statements don't have any special characters to them (e.g. {)
    Just like this:

    if A then B else C

    OR

    if A then
    B
    else
    C
    end if

    and same goes for the for and while statements

    I tried setting up folding in UDL2, but nothing I did worked correctly
    If anyone can offer some help I would really appreciate it.
    Thanks!
    Davey

    P.S. I would like to take this opportunity to thank
    DonHo for the program - its awesome
    Loreia2 for making UDL2 - it makes the awesome much better!
    And everyone else who contributes and offers their plugins
    THANKS!

     
    Last edit: Davey 2013-06-11
  • Loreia2

    Loreia2 - 2013-06-11

    Hi

    if A then B else C
    
    OR
    
    if A then
    B
    else
    C
    end if
    ~~~~~~~~~~~~~~~
    
    Inconsistent syntax like this one is really hard to parse with generic code parser. In first example if statement does not have a closing keyword, and the multiline version in second example does have it ("end if").
    
    The best thing you can do in UDL2 is by cheating a bit.
    Define Folding in code 2 type as:
    open: if
    middle: else
    close: "end if"
    Define Folding in comment as:
    close: end
    
    Then rewrite your code like this (lets use // as line comment keyword):
    

    if A then B else C // end

    OR

    if A then
    B
    else
    C
    end if
    ~~~~~~~~~~~~~~~

    This should work (don't have a windows box to test it right now), but the down side is that you have to change the code in order to make it work.

    ~~~~~~~~~~~~~~~~~~~~~~~~
    P.S. I would like to take this opportunity to thank
    DonHo for the program - its awesome
    Loreia2 for making UDL2 - it makes the awesome much better!
    And everyone else who contributes and offers their plugins
    THANKS!
    ~~~~~~~~~~~~~~~~~~~~~~~

    It has been both a pleasure and a prividlege to work on UDL2

    BR,
    Loreia

     
  • Davey

    Davey - 2013-06-12

    Thanks Loreia2
    I really appreciate your time and efforts.
    I tried what you said:
    Everything seems to work great as you said
    (However, like you said, it'll be a pain to change the coding...)

    Thank you very much
    Davey

     
  • Petr

    Petr - 2013-11-28

    Hi,

    Firsly thank you for this excellent tool and for your helpful support here!

    I'd like to ask for an advice with folding. I want to enable it for Autosys JIL file. There are job definitions starting with comment, followed by job settings and ended with a blank line. It would be great to have this block foldable - the block is surrounded by comment and blank line.

    I set folding Open to "/*" and Close to "((EOL))". The + sign is showed but blank line ending is ignored.

    Please see the attached screenshot.

    Additionally this works only when comment Open & Close is not set (when I set comment Open to "/*" the + sign is not shown at all).

    Any help would be appreciated.

    Thank you,
    Petr

     
    Last edit: Petr 2013-11-28
  • Loreia2

    Loreia2 - 2013-11-30

    Hi Petr,

    unfortunately this is not possible.
    ((EOL)) is only used for Delimiters, not for Folding keywords.
    In fact Folding must be closed with some keyword, not whitespace.

    But similar functionality is planned for UDL3.0, just subscribe to this thread, and you will be notified automatically when UDL3.o hits beta status.

    BR,
    Loreia

     
    • Petr

      Petr - 2013-12-02

      Excellent! Thank you, Loreia

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks