User Defined Language: Collapse block of text



  • Does anyone know how to create custom user collapsible or foldable sections of text using whitespaces:

    \r\n\t’ as open tag (new line, tab single quote)
    \r\n\t\t as closing tag (new line tab tab)

    New line is forcing folding only at new line, tab is transparent. I am able to create similar thing using spaces. But that is not ideal: no new line, and its easier to see double tab mistake compared to 3 of 5 spaces.



  • @CoR

    I’m afraid the answer is simple, you can’t. Folding like in python is not supported by UDL.



  • So, choices are:
    not possible
    plugin (if it is possible to do it in plugin way)
    a feature request

    :(



  • @CoR said in User Defined Language: Collapse block of text:

    So, choices are:
    not possible

    natively, correct, it is not currently possible

    plugin (if it is possible to do it in plugin way)

    that would work. plugins can be used to define whole new lexers in the language menu, so yes, a plugin could handle what you wanted, if such a plugin were to be written (I doubt one with that exact feature is already in the Plugins Admin list of plugins).

    With some effort, it could probably also be implemented using the already-existing PythonScript or LuaScript plugin, which allow you to write Python or Lua code to control the Notepad++ GUI and editor windows, including influencing things like syntax highlighting and code folding. My guess is that it would use a similar technique to what @Ekopalypse implemented for regex-based extra-syntax highlighting in this post, but you’d have to find the code-folding rather than text-coloring code to manipulate.

    a feature request

    You could try, yes. However, no new features have been added to User Defined Languages (UDL) system in years, and there are many open bug reports and feature requests for UDL improvements … Sorry that I don’t have better news on that front. :-(

    :(

    Indeed.


Log in to reply