• Login
Community
  • Login

UDL Multiple Styles/Colors for Operators

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 3 Posters 1.6k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B
    Bev
    last edited by Jan 11, 2022, 2:32 PM

    tldr; Is it possible to have two groups of operators, each one having their own style?

    I’m not a coder, I’m using npp for translating games, there is some code tinkering involved, but I mostly work on normal text. That’s why default Languages don’t really work for me so I’ve decided to define my own.

    I’ve pretty much got everything how I wanted, but I would like to have some symbols highlight with different colors: " ( ) with one, and . , ? ! with the other. Is this possible e.g. through editing UDL file?

    P L 2 Replies Last reply Jan 11, 2022, 2:35 PM Reply Quote 0
    • P
      PeterJones @Bev
      last edited by Jan 11, 2022, 2:35 PM

      @bev ,

      No, UDL only has one style associated with both the Operators1 and Operators2 fields, so all operators will use the same color, if using only the UDL feature set. Sorry.

      But you can add extra highlighting to a User Defined Language (UDL) using regexes via the PythonScript plugin in conjunction with the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo – the comments in the script explain how to install and customize it. If you give it a go, and need help, feel free to show what you’ve got so far, and @Ekopalypse or one of the regulars here will probably be able to nudge you in the right direction.

      1 Reply Last reply Reply Quote 4
      • L
        Lycan Thrope @Bev
        last edited by Jan 11, 2022, 7:04 PM

        @bev
        In addition to what Peter has mentioned, you could get a different color for the parenthesis by using them as delimiters of which there are 8 slots to put them and style them.
        Open: ( ?
        Close: ) !

        Other than that, Peters right that you can’t style the operators 1 or 2 differently than the one style. Good Luck.

        Lee

        1 Reply Last reply Reply Quote 3
        • B
          Bev
          last edited by Jan 12, 2022, 8:05 AM

          Well, now I feel dumb.

          Somehow I didn’t realised what Nesting is for. Eh.
          I was able to rearrange everything and make it work.

          Thanks for help guys.

          1 Reply Last reply Reply Quote 4
          4 out of 4
          • First post
            4/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors