Community
    • Login

    function-list

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    8 Posts 3 Posters 7.0k 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.
    • Michael PeterM
      Michael Peter
      last edited by

      Hi, has anybody an idea?

      notepad++ (vers. 6.9) doesn’t show static functions in the function-list.

      Is there any way to change it?

      Thanks

      Michael

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank @Michael Peter
        last edited by

        Hello @Michael-Peter,

        Is there any way to change it?

        I assume so, either you check functionList.xml if there is something you can change
        or you provide a little bit more information about which language you are talking.
        Please don’t expect that everyone knows the language in detail so an example
        to illustrate your question might be helpful as well.

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • Michael PeterM
          Michael Peter
          last edited by

          Oh, sorry, the language is PHP.

          If I have construction like below, the functionlist shows funktion f2, but not f1.

          CODE:

          <?php declare(strict_types=1);
          class Html {

          // ------------------------------------------------------------------
          static function f1() {
          // ------------------------------------------------------------------
          echo ‘hello world’;
          }

          // ------------------------------------------------------------------
          function f2() {
          // ------------------------------------------------------------------
          echo ‘hello world’;
          }

          ?>

          Claudia FrankC 2 Replies Last reply Reply Quote 0
          • Claudia FrankC
            Claudia Frank @Michael Peter
            last edited by

            Hello @Michael-Peter,

            code is missing the closing } for the class.

            Cheers
            Claudia

            1 Reply Last reply Reply Quote 0
            • Claudia FrankC
              Claudia Frank @Michael Peter
              last edited by

              Hello @Michael-Peter,

              in addition to the missing } another issue is when having class code which isn’t indented then it doesn’t
              find the function as well. The mainExpr needs to be changed, to be more concrete the second check
              about static|public … starts with \s+ which means, there must be at least one space before the modifier follows.
              To solve this \s+ needs to be replaced to \s*
              Like this

              mainExpr="^[\s]*((static|public|protected|private|final)*(\s*(static|public|protected|private|final))+[\s]+)?(function[\s]+)+([\w]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+))?([\w_]+[\s]*::)?(?!(if|while|for|switch))[\w_~]+[\s]*\([^\{]*\{">
              

              Cheers
              Claudia

              1 Reply Last reply Reply Quote 0
              • guy038G
                guy038
                last edited by guy038

                Hello Michael,

                In addition to the two correct assertions, in the Claudia’s post, concerning :

                • The missing closing brace, for the class Html

                • The change of \s+ into \s*, in the regex relative to a function, embedded in a class

                may be, it would be judicious to change, also, at line #196, the regex, for mainExpr of a function, located outside a class, into :

                mainExpr="^[\s]*((static|public|protected|private|final)\s+)?function[\s]+\w+\("
                

                I just added the list of each possible reserved word, that may be located BEFORE the word function, and some mandatory blank characters, with the regex ((static|public|protected|private|final)\s+)?

                I said “may be”, as I don’t know the PHP language, unfortunately :-((

                But, considering the example below :

                <?php declare(strict_types=1);
                class Html {
                
                // ------------------------------------------------------------------
                static function f1() {
                // ------------------------------------------------------------------
                echo ‘hello world’;
                }
                
                // ------------------------------------------------------------------
                function f2() {
                // ------------------------------------------------------------------
                echo ‘hello world’;
                }
                }
                
                // ------------------------------------------------------------------
                private function f3() {
                // ------------------------------------------------------------------
                echo ‘hello world’;
                }
                
                // ------------------------------------------------------------------
                function f4() {
                // ------------------------------------------------------------------
                echo ‘hello world’;
                }
                
                ?>
                

                With my modification, at line #196, the function f3, as well as the functions f1, f2 and f4, appears, too, in the Function List panel !

                Best Regards,

                guy038

                P.S. :

                You can modify the functionList.xml file, directly, from inside Notepad++. Just close and re-start N++ to get the modifications in the Function List panel !

                Claudia FrankC 1 Reply Last reply Reply Quote 0
                • Claudia FrankC
                  Claudia Frank @guy038
                  last edited by

                  Hello @guy038,

                  afaik the modifiers are only allowed in classes.
                  You cannot have a function, outside a class, defined as e.g. private function xyz().
                  I did a quick search on the internet but didn’t find a hint that it is possible now.
                  But if I’m wrong, then of course your changes make sense (as always;-))

                  Cheers
                  Claudia

                  Btw. don’t tell me your still skiing ;-)

                  1 Reply Last reply Reply Quote 0
                  • Michael PeterM
                    Michael Peter
                    last edited by

                    Claudia Frank matches the point with her contribution: “…another issue is when having class code which isn’t indented then it doesn’t find the function as well…”.

                    Thanks a lot…

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