Community
    • Login

    Key words In Language

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    8 Posts 3 Posters 2.3k 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.
    • Dennis BareisD
      Dennis Bareis
      last edited by

      For the most part, I have managed to create my own language configuration but I can’t work out how to define keywords containing spaces, I’ve tried double quotes and “%20”. For example, I want to highlight “service number” but NOT each word individually.

      Also, can someone confirm that regular expressions can’t somehow be used? I was looking through some of the preconfigured definition files and they appear to contain regular expressions.

      Lycan ThropeL 1 Reply Last reply Reply Quote 0
      • Lycan ThropeL
        Lycan Thrope @Dennis Bareis
        last edited by

        @dennis-bareis , that seems contrary to the manual on UDL, as quoted

        Separate each keyword by a space (and that means that spaces are not allowed in keywords unless you put quotes around the phrase).

        In the UDL Configuration Tabs-Keywords List part of the manual.

        I know, I’ve been making up my own UDL this month, so it seems like either you’re looking somewhere else (FunctionList or Autocompletion maybe?) rather than the Keyords List.

        Lee

        Dennis BareisD 1 Reply Last reply Reply Quote 1
        • Dennis BareisD
          Dennis Bareis @Lycan Thrope
          last edited by

          @lycan-thrope said in Key words In Language:

          @dennis-bareis , that seems contrary to the manual on UDL, as quoted

          Separate each keyword by a space (and that means that spaces are not allowed in keywords unless you put quotes around the phrase).

          In the UDL Configuration Tabs-Keywords List part of the manual.

          Thanks that page doesn’t mention regular expressions so I’m guessing they aren’t supported. If they were, life would be much simpler :-(

          As for the manual it mentions quotes but not which type, I can confirm that both single or double work. I remember now that I tried it on “Comment & Number” -> “Comment style” and there it doesn’t work for some reason. I’m there because I need to mark a start and end on different lines.

          Lycan ThropeL PeterJonesP 3 Replies Last reply Reply Quote 0
          • Lycan ThropeL
            Lycan Thrope @Dennis Bareis
            last edited by

            @dennis-bareis , both actually (single and double) as the below screenshots show, in both the open/close lists and the Keyword tab. If one doesn’t work, try the other is the best I can suggest. :-) Good luck.

            Lee

            NPPKeyWordUDLBoxOpen_Close.PNG

            NPPKeyWordUDLBoxKeywordTab.PNG

            1 Reply Last reply Reply Quote 3
            • PeterJonesP
              PeterJones @Dennis Bareis
              last edited by PeterJones

              @dennis-bareis said in Key words In Language:

              that page doesn’t mention regular expressions so I’m guessing they aren’t supported. If they were, life would be much simpler :-(

              Unfortunately, regex-in-UDL is a UDL feature request which has never been implemented. However, you can add extra highlighting to a User Defined Language (beyond what the UDL does by keyword and constant strings) using regexes via the PythonScript plugin in conjunction with the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo. So a UDL combined with EnhanceAnyLexer.py is a highly-customizable solution.

              1 Reply Last reply Reply Quote 4
              • Lycan ThropeL
                Lycan Thrope @Dennis Bareis
                last edited by

                @dennis-bareis , I’m sorry I almost missed what you were saying also, though the Keyword List allows quoting multiple words, I don’t think the Comment/Numbers tab does. If you have questions, or haven’t had a chance to get a better handle on what the UDL can do, you need to check this better explanation about the UDL 2.1 that you’re currently using in NPP, here that I had to read first to learn about the forward/backward aspect of the UDL parser and what you can and can’t do in each section. I’m sorry if you didn’t read this and I didn’t get you the link to this sooner, as it is mentioned in the manual also, but no you have it. :-) Again, good luck. It took a while and a lot of help here for me to getthe UDL and the additional capabilities in NPP for the language.

                I’m holding off having to learn Python to get into any more enhancements, so that’s on me, but most of what I need to do and beyond, I can do with the current tools, up to this point. Good Luck again.

                Lee

                Dennis BareisD 1 Reply Last reply Reply Quote 1
                • Dennis BareisD
                  Dennis Bareis @Lycan Thrope
                  last edited by

                  @lycan-thrope @PeterJones

                  Thanks for the pointers, I’ll have a look at this later as I have things good enough for now, I’ve added the information for Evernote for when I get back to it.

                  I do have a general questions, does the app have known highlighting bugs or should I report them? It sometimes highlights too much and if you go and add a line and remove it that fixes is.

                  Lycan ThropeL 1 Reply Last reply Reply Quote 2
                  • Lycan ThropeL
                    Lycan Thrope @Dennis Bareis
                    last edited by

                    @dennis-bareis
                    Not that I know of, but then again, I’m new to this aspect of UDL’ing also, however, the one thing that I did learn from reading that document about the UDL, is that you need to play with it to make sure your UDL is functioning properly.

                    For instance, if you have nested parenthesis, you need to set up the nesting properly, or it will continue highlighting if say, you had a nested parenthesis starting inside another parenthesis and you didn’t have it set to next…and may continue highlighting or not, until it hit the second one. That seems to be part of the matching brace aspect of NPP, but if the kewords, parens, braces…etc aren’t properly set up to nest properly, it will continue highlighting text you think shouldn’t be.

                    When you get a chance to get back to it, you may see what I’m saying. :-)

                    Good Luck.

                    Lee

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