Community
    • Login

    Custom Language numbers only working in some places

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 3 Posters 333 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.
    • Victor NonyaV
      Victor Nonya
      last edited by Victor Nonya

      I have an issue getting numbers to style how I want them too.

      Screenshot 2023-06-03 094436.png

      I want it to change any number that is by itself anywhere in the code such as inside of () or [] etc although it’s working inside of [] but not inside of the ()

      Screenshot 2023-06-03 094603.png

      although it did work in this instance

      Screenshot 2023-06-03 095506.png

      what I don’t want it to do is change a number that is next to any word such as the circle with the red x I want those to stay the same. I don’t want the numbers that are attached to variable names, etc to change if that makes sense.

      Here is all my settings so far building this style

      Screenshot 2023-06-03 095154.png
      Screenshot 2023-06-03 095331.png
      Screenshot 2023-06-03 095322.png
      Screenshot 2023-06-03 095310.png

      EkopalypseE 1 Reply Last reply Reply Quote 0
      • EkopalypseE
        Ekopalypse @Victor Nonya
        last edited by

        @Victor-Nonya

        Use the comma as an additional operator or define it inside suffix1 or 2 in the number style.

        Victor NonyaV 1 Reply Last reply Reply Quote 1
        • Victor NonyaV
          Victor Nonya @Ekopalypse
          last edited by

          @Ekopalypse The delimiter for the comma worked great thanks!

          What about for stuff I’m using in the keywords? The comma after each one is being set to the same color as the keyword.

          How do I make sure all commas are the same color and not included in the syntax highlighting?

          Screenshot 2023-06-03 113116.png
          Screenshot 2023-06-03 113105.png

          Also na is be used as an argument such a true or false but it also can be a function like in this example. How do I set different color for each. I need the na functions to be blue like the others?

          Screenshot 2023-06-03 113449.png

          Also the na’s inside of a function are not being colored as well. They should be pinkish color as well. Like this.

          Screenshot 2023-06-03 113633.png

          which is the editor in tradingview which I am trying to imitate for a styling in notepad++

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @Victor Nonya
            last edited by

            @Victor-Nonya ,

            I am assuming () are set as a set of delimiters… If so, then in the delimiters styler, you need to make sure you allow nesting for operators and the appropriate keywords.

            I didn’t fully replicate your results, but something like this:

            Without nesting, it looks like:
            e2bd4236-67c9-4f37-8eea-ce38ab5711f3-image.png

            With nesting added, it looks like:
            b6cb5b4d-4ded-4c85-be53-35b2b0af2db7-image.png

            Victor NonyaV 1 Reply Last reply Reply Quote 0
            • Victor NonyaV
              Victor Nonya @PeterJones
              last edited by

              @PeterJones I put the delimiter in it’s own style like under the Delimiter 1 style I put the commas as the end instead of adding the commas on the main delimiter at the top. That caused the issues it was my own mistake that made it not work properly.

              Thanks again for all your help

              I just need to figure out how to get the last na the correct color. Which is these.

              Screenshot 2023-06-03 122816.png

              I need the na after the = to also be the pinkish/brown color.

              Also if I add numbers in the () delimiter to allow numbers to change orange like the rest of the code it also changes numbers that are not supposed to change like this.

              Screenshot 2023-06-03 130032.png

              PeterJonesP 1 Reply Last reply Reply Quote 0
              • PeterJonesP
                PeterJones @Victor Nonya
                last edited by

                @Victor-Nonya said in Custom Language numbers only working in some places:

                I need the na after the = to also be the pinkish/brown color.

                I showed you the example where the na in both locations was the same color. I don’t know what you currently have, so there’s no way for me to know why it’s different for you. My guess is you have na defined in two conflicting locations, but it’s impossible for me to know for sure.

                As far as the numbers go, you may have hit upon one of the limitations of UDL. You can do a lot in UDL – as you have already seen – but there are limits to the rules that can be implemented. If you can get close to what you want, you can sometimes use @Ekopalypse’s EnhanceAnyLexer to add a regex that can change the foreground color based on a regular expression – so you could either turn off nesting of numbers inside of DELIMITER (...) , and then use EnhanceAnyLexer to only match digits that aren’t part of an alphanumeric “word” and colors them the same as a normal word, or you could turn on nesting of numbers inside DELIMITER (...) and then use EnhanceAnyLexer to match “words” that contain numbers at the end and colors them to match non-highlighted text: either should work

                Victor NonyaV 1 Reply Last reply Reply Quote 0
                • Victor NonyaV
                  Victor Nonya @PeterJones
                  last edited by Victor Nonya

                  @PeterJones Yes but the example you showed all the na’s were the same color. In your example all three of the na’s in different locations were all orange.

                  I’m trying to set the na function to another color and all the other na’s be orange.

                  in your example you have the function as orange. I need it to be blue but I still need the na, na, na, and the = na to be orange.

                  the result I’m looking for would look like this.

                  Screenshot 2023-06-03 133744.png

                  It may also be a limitation like with the numbers that I’ll just have to live with it being the same color which is fine if that’s the case it doesn’t have to be identical to the tradingview editor.

                  I’ve added na in two locations in the keywords section. One in the main keywords that stores all the functions which are blue. Then I’ve added it again in another keyword section that is pinkish color and using the () delimiter it works great as long as the na’s are inside the () but the ones outside are blue so it’s probably just a limitation that I’ll have to live with since the na’s that are functions are also outside of the ().

                  as far as the numbers issue I can always change the way I am coding and stop using numbers in the variables and type them out like one, two, three if that truly bothers me. it’s not really a big issue. It is super cool the stuff you can do with notepad++ I do enjoy learning this stuff.

                  EDIT: after removing the () delimiter that I was only using for the na that fixed the issue with the numbers not working. All the numbers show up as they should now. I’ll just live with all the na’s being one color it’s not too big of an issue for me.

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