Community
    • 登入

    Included FunctionList is not compatible with the most Java files

    已排程 已置頂 已鎖定 已移動 Help wanted · · · – – – · · ·
    listjavafunctionsfunctionlist
    7 貼文 4 Posters 4.8k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • stefan1200_deS
      stefan1200_de
      最後由 編輯

      I use Notepad++ 6.7.9.2 and noticed that the included function list is not compatible with the most Java files. I only have limited RegExp abilities, so I don’t fully understand the RegExp at the functionList.xml. Maybe someone can help me with it?

      Of course, if everything works like expected after fixing that, it would be nice to have this in the official release, but I can open an issue in the BugTracker with the solution, as soon as I have one.

      Here an example Java file, where the FunctionList is displaying nothing (I know much more, but they are quite similar to this one):
      JTS3ServerQuery.java
      Very simple Java files without any comments and other stuff working fine. But more complex Java files don’t work.

      1 條回覆 最後回覆 回覆 引用 0
      • RicardoR
        Ricardo
        最後由 編輯

        I was looking at this, I figured out the problem is really really simple:
        It expects the file ends with a blank line – or a comment, or anything that can make the last function closing tag “}” not the last character in the file.

        1 條回覆 最後回覆 回覆 引用 1
        • guy038G
          guy038
          最後由 guy038 編輯

          Hello Ricardo,

          Many thanks for your clever solution !

          Of course, I downloaded the Java file of Stefan1200_de but was unable to find the problem :-(( I tried to do some tests, changing the regular expressions of the Java parser, in the functionList.xml file, without any positive result.


          BTW, I’m not sure but I think that the regex for comments, in the Java parser, is invalid.

          Instead, of the form ((/\*.*?\*)/|(//.**$)), it should, simply, be written /\*.*?\*/|//.*?$

          Best Regards,

          guy038

          1 條回覆 最後回覆 回覆 引用 0
          • RicardoR
            Ricardo
            最後由 編輯

            I’ve tested clearing commentExpr for java and php in functionList.xml but it simply didn’t chance anything when exhibiting files (yes, restarted Npp). Do you confirm?

            I think comments might be controlled by Scintilla source, more exactly LexCPP.cxx

            1 條回覆 最後回覆 回覆 引用 0
            • guy038G
              guy038
              最後由 guy038 編輯

              Hi Ricardo,

              The part of the Java regex comments that is invalid is the second part : (//.**$). However, in PHP, the comments regex seems OK.

              Anyway, I think that you’re right about the control of comments. Indeed, I did some tests and whatever the part

              commentExpr="((/\*.*?\*)/|(//.**$))
              

              is present or NOT, it doesn’t change, at all, the behaviour of FunctionList !?

              For instance, if I add the text, below

              public Test()
              {
              }
              

              anywhere, inside a Java file, the functionList, normally, shows this fonction, on saving the Java file

              As soon as I surround this fonction by comments character as :

              /* public Test() */
              {
              }
              

              or as :

              /** public Test() **/
              {
              }
              

              or as :

              // public Test()
              {
              }
              

              FunctionList DOESN’T list, as expected, the function Test

              Results are similar, after deleting the commentexpr part, of the Java parser, and restarting N++. So, as you said, it must be handled at Scintilla level. Otherwise, it should have showed the Test function, although the function Test is glued in comments !

              Unfortunately, my poor programmer skills prevent me to go further, in that matter :-((

              Cheers,

              guy038

              1 條回覆 最後回覆 回覆 引用 1
              • stefan1200_deS
                stefan1200_de
                最後由 編輯

                Hello Ricardo and Guy038,

                thanks for being investigative at this topic.

                I’m not sure how to solve this issue. Is this solvable by changing the functionList.xml file, or do I have to file a bug report at the bug tracker?

                Best Regards,
                Stefan

                1 條回覆 最後回覆 回覆 引用 0
                • Stefan1200S
                  Stefan1200
                  最後由 編輯

                  With Notepad++ v7 I still have this problems. Can someone help fixing this? Thanks in advance. :)

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