Prevent code folding style to override keyword style



  • Hey everyone,

    I am new here and I did not find a solution on this side or elsewhere.

    I work with LS-Dyna keyfiles and use syntax highlighting. In those keyfiles, there are keywords (e.g. *PART, *NODE, *SET_NODE_GENERAL_TITLE) followed by lines with comments or other lines.
    At the moment I use an UDL, which highlights all keywords via their prefix ‘*’. (Keywords List > 1st group: prefix mode activated and ‘*’)
    I also want to use folding, since some keywords can be followed by hundreds of thousands of lines before another keyword. This already works fine, since I set ‘Folder & Default > Folding in code 1 style > Middle > ‘*’’

    The problem is that the style for ‘Folding in code 1 style’ overrides the style of the keywords and it only colors the asterisk ‘*’. The rest of the keyword has standard style.

    How can I have the keywords colored again? Is it possible to avoid style override? Is it possible to use the folding style for the whole text, following the asterisk? A possible solution would be to enter a complete list of keywords with separators, but that is not a good solution.

    I hope this is an easy fix, thank you.



  • @jnm91 said in Prevent code folding style to override keyword style:

    enter a complete list of keywords with separators, but that is not a good solution.

    That’s the only solution I can think of. That’s the way keywords are done in the other lexers and in all the other UDL I’ve seen: they are just fully enumerated in the appropriate keyword list. I’ve seen keword lists with thousands of keywords work properly.



  • Yes, I think it would work.

    The thing is, I do not have a complete list of keywords… If I would miss a keyword in the list and it appears in my keyfile, it would disappear, when I fold all. I would have to write a script that crawls through the LS-DYNA manuals and gives me a list of all keywords in the correct format to paste into notepad settings.

    It seems so unnecessary, since it is such an easy logic. (everything starting with an asterisk is a keyword)
    Also it already works in the ‘Keyword Lists’ tab, where I just have to enter an asterisk and prefix mode.



  • It seems so unnecessary, since it is such an easy logic.

    It’s not how UDL was designed. Matching everything by regex would also be “easy logic”, but that’s not how UDL was designed either.

    If you would like to request a change to the UDL lexer, feel free to make a request per the FAQ – however, it should be noted that the last feature change to UDL was in 2016, and lots of open UDL-feature-requests, so the chances of your feature-request being implemented anytime soon are… well, not great, I’m sorry to say.



  • two more thoughts:

    1. Even if a script reads all keywords out of the manuals (handbook), it would not generate a complete list of keywords. Often the keyword gets longer and longer when options are added, e.g. *SET_NODE_GENERATE_TITLE, where just different options such as ‘title’ are given in the text, but are not explicitly written as one coherent keyword.

    2. If I use ‘Folding in code 1 style’ and ‘middle’, I can enter a list with commonly used keywords followed by a single asterisk, e.g. *KEYWORD *NODE *ELEMENT_SHELL *. Then, there would be no risk of hiding any keywords, but only those keywords or partial keywords would be highlighted correctly, which are listed here.



  • @PeterJones Well it recognizes ‘*’ as a prefix for keywords and highlights them. It just does not do the same for folding.



  • I have explained the situation to the best of my ability, and shown you where to go to ask for this feature.

    Continuing to try to “convince” me is pointless. I have no authority to force someone else to make the changes; I do not have the set of knowledge to make and submit the changes myself (nor the time, even if I had the knowledge). If you have the knowledge and time, then submit the pull request yourself, and see if it gets accepted; if you don’t, then submit the feature request and wait to see if anyone else has the time and ability and approval to implement it. There’s nothing more I can do for you.

    Good luck.


Log in to reply