New UserDefinedLang - code fold must begin at margin



  • NPP version: 7.7.1
    UDL ver 2.1.0.12

    I am creating a user-defined-language and am having trouble with the code-folding definitions. Most of the UDL is working great, but it would be great to get the subroutines folding, since I have over a hundred of them.

    In this language, subroutines are defined as in this example:

    :MySubTitle
    code line here
    code line here
    code line here
    Return

    I wish to fold between the : and the word Return (the subroutine’s title could be any string of chars). Problem: the concat character is also a colon (:) – and these can be found anywhere in the code. Also, the word Return could be found at other places within a subroutine. If either of these cases is true, the code folding goes completely bonkers – for example if a colon ( : ) character is encountered anywhere inside a subroutine (and since the colon is the concat character, this happens a lot). So basically, I cannot code fold the subroutines – see the screenshot at end of this message).

    In this language, note that subroutine :Label / Return are always at the left margin (or indented one tab). In fact, it would be just fine if code-folding required the subroutine start/end to be found at the beginning of the line (not indented at all).

    So, is it possible to tell NPP that the code-fold triggers are ONLY valid if found at the beginning of the line (or after some whitespace) ? If not, can this be made into a feature request? Note that I do not have a “Prefix Mode” checkbox anywhere in the “Folding in code N style” groups (“Folder & Default” tab) - see below screenshot.

    screenshot

    Again, my version info is:
    NPP version: 7.7.1
    UDL ver 2.1.0.12



  • @gibberishbc said in New UserDefinedLang - code fold must begin at margin:

    :MySubTitle
    code line here
    code line here
    code line here
    Return

    Afaik, jein, you can, if this is possible on your side, create multiple opens,
    to be exact - for each letter an open folder tag like :A :B :C … and fake the
    return statement with an added comment tag. This might work.

    To address feature requests, see here.


Log in to reply