UDL fails to highlight operator depending on trailing character?



  • This is driving me crazy after many failed attempts.

    Suppose I have the line:
    $If(foobar)

    Now I want the operator $If to get highlighted.

    I tried using keywords, but failed.
    Trying operators gets some results, but also fails in many cases.

    As you can see in the screenshot it will work for the syntax at the bottom, but not the one at the top.
    It looks like it’s related to the character right behind the ( being an alphanumerical or a non-standard character.

    alt text

    How can I make this work?



  • Hello, @jared-123,

    Why not about putting $If in the Operators 1 field ?, only

    Best Regards,

    guy038



  • Thank you guy038!

    That was a brain-reset I needed.
    Obviously, the example I gave was extremely simple, and for the more advanced needs I already used that field for something else, and started ‘building’ and experimenting elsewhere. So it wasn’t available anymore.
    Using your suggestion as a starting point, I tried again again with a clean sheet, and now I have gotten (almost) everything to work perfectly.
    So, Thanx!

    (f.w.i.w.; I would have joined this forum much earlier to find answers and participate with ideas and suggestions if the mandatory Facebook/Google login hadn’t made me shake my head and turn around many times.
    That is an awful forum design decision and I find it very demotivating)



  • @Jared-123 said in UDL fails to highlight operator depending on trailing character?:

    I already used that field for something else,

    The definition of the Operators 1 field is “These operators can be “glued” to other keywords”, meaning it does not require spaces between the operator and the keywords or other text nearby. The definition of the Operators 2 field is “These operators can NOT be “glued” to other keywords”, meaning they must have spaces. That’s the technical difference between those two. If you want the operator to be glue (no spaces), you will have to use the Operators 1 field. Those are the only two options for operators.

    Personally, I would use something different for $If, because “if” is a keyword, not an operator, in most languages. I would use either one of the many keyword fields, with or without Prefix mode as needed; or I would use it in the folding-in-code (because collapsing if blocks is often useful).



  • @Jared-123 said in UDL fails to highlight operator depending on trailing character?:

    That is an awful forum design decision

    In your opinion.

    From a security and maintenance standpoint, it is an excellent decision, and I applaud it. If the Community Forum had to maintain its own database of user-to-password, then the Community Forum admin team (or person) would have to personally ensure security, making sure the server never gets hacked, responding to hacking threats, making updates, etc

    Instead, by using a common and open-source OAuth mechanism through multiple of the major OAuth providers, all the security is maintained by the mega-corps, who have a vested interest in keeping the login credentials secure, and have paid staff with job descriptions including maintaining that security.
    The Notepad++ Community could never provide anything as secure as that.

    With the resources of a Google, Facebook, Stack Exchange, or similar, and professional security experts on your team, it makes sense to control everything to that depth; for a mom-and-pop (or Don-and-friends) group like the Notepad++ Community, it just doesn’t – and when (not if) the home-rolled security was broken, you would be singing a very different tune.


Log in to reply