Community
    • 登入

    UDL numbers problem

    已排程 已置頂 已鎖定 已移動 General Discussion
    12 貼文 3 Posters 1.5k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Ivan KarpovI
      Ivan Karpov
      最後由 Ivan Karpov 編輯

      Good day to everyone. I managed to somehow add my first UDL in Notepad++ v7.8.9 but one thing still concern me too much to start using it just right now…

      So here’s the deal. I’m using some specified keywords like “ScriptItemActObject1”, “t_OnAnotherItem2” and so on. They are contained a number on their tails. I cannot rename this keywords, so I really need to adapt them for normal work with UDL.
      Still, then I’m trying to do that, Notepad is just giving me huge bag of frustration. Since I read many topics about “How hard to add correct prefix/suffix” to the numbers highlight, I was never expecting to this:
      29d1e14e-1691-4f5e-a9ba-ec5192342a7c-image.png
      As you may see, numbers here got the priority over my keywords, but I can’t really understand why. It seems even more frustrating, since I never added any additional symbols to number highlights (instead of one “.”) at all:
      6b6534f7-330e-42e8-8619-32803ca1415f-image.png

      Any possible recommendations are welcomed.

      PeterJonesP 1 條回覆 最後回覆 回覆 引用 0
      • PeterJonesP
        PeterJones @Ivan Karpov
        最後由 編輯

        @Ivan-Karpov said in UDL numbers problem:

        I am not sure what difficulty you are having. If I set up those two strings as keywords, and set the numerical colors to something different, I can easily tell the difference between the two:
        67342486-9572-49b4-81c5-226043836456-image.png
        3a3f678b-f938-4989-a4fb-d3f32670df97-image.png

        If you want more help, you will have to give us more information, because I cannot replicate your problem with the simple example I just showed.

        1 條回覆 最後回覆 回覆 引用 0
        • Ivan KarpovI
          Ivan Karpov
          最後由 Ivan Karpov 編輯

          All right… It might as well be some kind of delimiters problem. You need to add these group of keywords and the numbers inside any delimiter and then it turns out to look like this:
          d8177997-8596-4238-9171-c3d9f5ec6466-image.png
          bb1ab0f6-bd7a-4612-b141-9cc2f30ee57a-image.png

          Same if I clear all unnumbered keywords:
          6dd0a199-91f0-4036-9b08-b1adbbc374fa-image.png

          PeterJonesP 1 條回覆 最後回覆 回覆 引用 0
          • PeterJonesP
            PeterJones @Ivan Karpov
            最後由 編輯

            @Ivan-Karpov ,

            The UDL definition is not infinitely powerful, nor even a full programming langauge; if you keep looking, you will eventually found its limits – and you appear to have found one. I assume it’s not really inside quotes, but inside a function’s argument-list parentheses, where you want numbers formatted as numbers, and keywords as keywords. Either you need to just not mark the parentheses as delimiters (since you don’t seem to want stuff in the parentheses to be treated differently than the stuff outside), or you need an alternate way of highlighting instead of relying on the UDL syntax.

            So, if you need parentheses as delimiters, I suggest to use the PythonScript plugin, which can be used to add/change formatting from a builtin or UDL lexer using regexes, via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo : install the PythonScript plugin, create the script and populate it, then change the regexes to something that matches the “mix-formatted” keywords-with-numbers, and

            Ivan KarpovI 2 條回覆 最後回覆 回覆 引用 0
            • Ivan KarpovI
              Ivan Karpov @PeterJones
              最後由 Ivan Karpov 編輯

              @PeterJones said in UDL numbers problem:

              I suggest to use the PythonScript plugin

              Thanks, but I was looking more common way to fix this npp behavior.
              I’m afraid this script is too much for me to figuring out how it’s works (EnhanceAnyLexer I mean).
              Anyway, will try to check it.

              1 條回覆 最後回覆 回覆 引用 0
              • Ivan KarpovI
                Ivan Karpov
                最後由 Ivan Karpov 編輯

                In the end I just set up all numbers as keywords with prefix and turn nums off from all delimiters entirely :|
                473dc126-0bce-45db-94c2-5046979a16f9-image.png

                Guess it’s just works for me from now on. The stupid number priority is gone and I’m even still able to use HEX constants like 0x80LOL123.

                Will update this topic if I find any problems with such solution.

                1 條回覆 最後回覆 回覆 引用 0
                • Ivan KarpovI
                  Ivan Karpov @PeterJones
                  最後由 編輯

                  @PeterJones

                  Sorry to bother you once more… But is there any way to add all needed keywords groups from my UDL to automatically hintbox dropdown?
                  Maybe some kind of plugin already exist for that purpose?

                  EkopalypseE 1 條回覆 最後回覆 回覆 引用 0
                  • EkopalypseE
                    Ekopalypse @Ivan Karpov
                    最後由 Ekopalypse 編輯

                    @Ivan-Karpov

                    you have to create an autocomplete file like described here.
                    Regarding your previous issue about keywords and numbers,
                    I’m not sure I understand your solution.
                    prefix mode normally means defining a keyword like ScriptItemActObject and get everything colored which start
                    with those keywords like ScriptItemActObject1, ScriptItemActObject2 …
                    but also words like ScriptItemActObjectAndWhatEverIsAttached

                    Ivan KarpovI 1 條回覆 最後回覆 回覆 引用 1
                    • Ivan KarpovI
                      Ivan Karpov @Ekopalypse
                      最後由 編輯

                      @Ekopalypse said in UDL numbers problem:

                      but also words like ScriptItemActObjectAndWhatEverIsAttached

                      Sure do. But while I’m using prefix only on number simbols, I most likely, never will fall into 0.1AndWhatEverIsAttached problem, because there’s always some operators on the way ahead this numbers. And since my prefix “numeric” keywords has a lower priority than normal keywords, such a ScriptItemActObject1, it’s highlights only after them which is totally fine for my needs by now.

                      Here’s an example of how it looks:
                      9342a603-9e1a-4ea7-b54c-a4951e3f8762-image.png

                      Too bad, UDL functions are some buggy ad sometimes makes some errors in highlighting system:
                      2d0eb698-d57e-492c-a032-8c2eca28d8cb-image.png

                      Yet, this is not depends on my “numbers-keywords”, just some regular errors in UDL code.

                      EkopalypseE 1 條回覆 最後回覆 回覆 引用 0
                      • EkopalypseE
                        Ekopalypse @Ivan Karpov
                        最後由 Ekopalypse 編輯

                        @Ivan-Karpov

                        just some regular errors in UDL code.

                        Yes - I have also seen other problems like strange folding markers.
                        Unfortunately I’m not really a C++ guy and don’t know the code base
                        of UDLs enough to understand if this is something that needs to be
                        changed because of the introduced scintilla changes.

                        Ivan KarpovI 1 條回覆 最後回覆 回覆 引用 0
                        • Ivan KarpovI
                          Ivan Karpov @Ekopalypse
                          最後由 Ivan Karpov 編輯

                          @Ekopalypse said in UDL numbers problem:

                          Yes - I have also seen other problems like strange folding markers.

                          The most strange about folding markers in UDL is that I can’t use them with stylers. There’s just no options to highlight any groups of keywords or other anything else inside the folding markers. Instead I may create “folding” markers as a delimiter, but then it just refuse to folding anymore :/
                          And I can’t just adjust delimiter and folding markers with the same symbols, because delimiters have absolute priority over folding markers.

                          EkopalypseE 1 條回覆 最後回覆 回覆 引用 0
                          • EkopalypseE
                            Ekopalypse @Ivan Karpov
                            最後由 編輯

                            @Ivan-Karpov

                            No, what I meant refers to such an issue

                            d22dd10b-82a0-4edd-8ef4-23896e3170c2-image.png

                            where the folding marker is out of sync with the code block.

                            1 條回覆 最後回覆 回覆 引用 1
                            • 第一個貼文
                              最後的貼文
                            The Community of users of the Notepad++ text editor.
                            Powered by NodeBB | Contributors