Community
    • Login

    Function List not working in v7.2

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    30 Posts 13 Posters 43.2k Views 4 Watching
    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.
    • t12122013 FinkT Offline
      t12122013 Fink
      last edited by t12122013 Fink

      `
      <parser
      displayName=“JavaScript”
      id =“javascript_function”
      commentExpr=“(?s:/.?*/)|(?m-s://.*?$)”

      	bemerkung1="für Kommentar zwischen function header und {. [\n\s]*\{ am Ende gelöscht."
      	bemerkung2="für new Function(...)  (?:new\s*)? eingefügt."
      	bemerkung3="für function (a,b,c) ohne Funktionsname ein \s* eingefügt."
      
        comment1="comment between function header and function body {, removed [\n\s]*\{"
        comment2="new Function() : inserted (?:new\s*)? "
        comment3="function (a,b,c) without function name: inserted \s*"
        comment4="comment within function header still not recognized. e.g. function /*returns real*/ a(b) { }"
          comment99="there must be something wrong with processing of commentExpr"
      	
      >
      <function
         	mainExpr="((^|\s+|[;\}\.])([A-Za-z_]\w*\.)*[A-Za-z_]\w*\s*[=:]|^|[\s;\}]+)\s*(?:new\s*)?function(\s+[A-Za-z_]?\w*\s*\([^\)\(]*\)|s*\([^\)\(]*\))"
      			
      			
            >
          <functionName>
              <nameExpr expr="[A-Za-z_]\w*\s*[=:]|[A-Za-z_]?\w*\s*\(" />
              <nameExpr expr="[A-Za-z_]?\w*" />
          </functionName>
          <className>
              <nameExpr expr="([A-Za-z_]\w*\.)*[A-Za-z_]\w*\." />
              <nameExpr expr="([A-Za-z_]\w*\.)*[A-Za-z_]\w*" />
          </className>
      </function>
        </parser>`
      
      1 Reply Last reply Reply Quote 0
      • t12122013 FinkT Offline
        t12122013 Fink
        last edited by t12122013 Fink

        trying again, by content and by form

        <parser
        displayName="JavaScript"
        id         ="javascript_function"
        	XcommentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)"
        
        	
        	bemerkung1="für Kommentar zwischen function header und {. [\n\s]*\{ am Ende gelöscht."
        	bemerkung2="für new Function(...)  (?:new\s*)? eingefügt."
        	bemerkung3="für function (a,b,c) ohne Funktionsname ein \s* eingefügt."
        	bemerkung4="Kommentar im Funktionsheader wird nicht behandelt, z.B. function /*returns real*/ a(b) { } "
        	bemerkung5="commentExpr überhaupt X-ed."
        	bemerkung99="Es muss etwas falsch sein mit commentExpr durch nichts ersetzen."
        	
        	comment1="Comment between function header and function body {: removed [\n\s]*\{ "
        comment2="new Function(): inserted (?:new\s*)? "
        comment3="function (a,b,c) without function name: inserted \s*" 
        comment4="Comment within function header still not handled. e.g. function /*returns real*/ a(b) { } "
        	comment5="commentExpr disabled: X-ed."
        comment99="There must be something wrong in NPP when replacing commentExpr by nothing."
        	
        >
        <function
           	mainExpr="((^|\s+|[;\}\.])([A-Za-z_]\w*\.)*[A-Za-z_]\w*\s*[=:]|^|[\s;\}]+)\s*(?:new\s*)?function(\s+[A-Za-z_]?\w*\s*\([^\)\(]*\)|s*\([^\)\(]*\))"
        >
            <functionName>
                <nameExpr expr="[A-Za-z_]\w*\s*[=:]|[A-Za-z_]?\w*\s*\(" />
                <nameExpr expr="[A-Za-z_]?\w*" />
            </functionName>
            <className>
                <nameExpr expr="([A-Za-z_]\w*\.)*[A-Za-z_]\w*\." />
                <nameExpr expr="([A-Za-z_]\w*\.)*[A-Za-z_]\w*" />
            </className>
        </function>
        </parser>
        
        1 Reply Last reply Reply Quote 0
        • MAPJe71M Offline
          MAPJe71
          last edited by MAPJe71

          Notepad++ uses the commentExpr to determine which parts of the text to skip when searching for classes, methods and/or functions.
          “Embedded” comments are not supported.

          1 Reply Last reply Reply Quote 0
          • MAPJe71M Offline
            MAPJe71
            last edited by

            @t12122013-Fink
            See also issues #344 and #1023 on GitHub.

            1 Reply Last reply Reply Quote 0
            • David LiangD Offline
              David Liang
              last edited by

              C# function list fix for v7.4.2
              Basically copy the function section inside classRange and paste it at the same level of classRange.
              <!-- ========================================================== [ C# ] -->

              		<!--
              		|   Based on:
              		|       http://sourceforge.net/p/notepad-plus/patches/613/
              		\-->
              		<parser
              			displayName="C#"
              			id         ="csharp_class"
              			commentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)"
              		>
              			<classRange
              				mainExpr    ="^[\t\x20]*((public|protected|private|internal)\s+)?(\w+\s*)?(class|struct|interface)[\t\x20]+[^\{]+\{"
              				openSymbole ="\{"
              				closeSymbole="\}"
              			>
              				<className>
              					<nameExpr expr="(class|struct|interface)[\t\x20]+\w+" />
              					<nameExpr expr="[\t\x20]+\w+" />
              					<nameExpr expr="\w+" />
              				</className>
              				<function
              					mainExpr="^[^\S\r\n]*(?&lt;modifier1&gt;(?:public|protected|internal|private)\s*)?(?&lt;modifier2&gt;(?:new|static|virtual|sealed|override|abstract|extern)\s*)?(partial\s*)?(?&lt;type&gt;(?!(return|if|else))\w+(?&lt;genericType&gt;&lt;[\w,\s&lt;&gt;]+&gt;)?\s+)(?&lt;name&gt;\w+(?&lt;genericNameType&gt;&lt;[\w,\s&lt;&gt;]+&gt;)?\s?)\((?&lt;params&gt;[\w\s,&lt;&gt;\[\]\:=\.]*)\)(?&lt;ctorChain&gt;\s*\:\s*(?:base|this)\s*\((?&lt;ctorParams&gt;[\w\s,&lt;&gt;\[\]\:=\.]*)\))?[\w\s&lt;&gt;\:,\(\)\[\]]*(?:\{|;)"
              				>
              					<functionName>
              						<funcNameExpr expr="(\w+(&lt;[\w,\s&lt;&gt;]+&gt;)?\s?)\(" />
              						<funcNameExpr expr="(\w+(&lt;[\w,\s&lt;&gt;]+&gt;)?\s?)" />
              					</functionName>
              				</function>
              			</classRange>
              			<function
              				mainExpr="^[^\S\r\n]*(?&lt;modifier1&gt;(?:public|protected|internal|private)\s*)?(?&lt;modifier2&gt;(?:new|static|virtual|sealed|override|abstract|extern)\s*)?(partial\s*)?(?&lt;type&gt;(?!(return|if|else))\w+(?&lt;genericType&gt;&lt;[\w,\s&lt;&gt;]+&gt;)?\s+)(?&lt;name&gt;\w+(?&lt;genericNameType&gt;&lt;[\w,\s&lt;&gt;]+&gt;)?\s?)\((?&lt;params&gt;[\w\s,&lt;&gt;\[\]\:=\.]*)\)(?&lt;ctorChain&gt;\s*\:\s*(?:base|this)\s*\((?&lt;ctorParams&gt;[\w\s,&lt;&gt;\[\]\:=\.]*)\))?[\w\s&lt;&gt;\:,\(\)\[\]]*(?:\{|;)"
              			>
              				<functionName>
              					<funcNameExpr expr="(\w+(&lt;[\w,\s&lt;&gt;]+&gt;)?\s?)\(" />
              					<funcNameExpr expr="(\w+(&lt;[\w,\s&lt;&gt;]+&gt;)?\s?)" />
              				</functionName>
              			</function>
              		</parser>
              
              maroonmoon13M 1 Reply Last reply Reply Quote 0
              • t12122013 FinkT Offline
                t12122013 Fink
                last edited by t12122013 Fink

                @ MAPJe71
                Thank you for the explanation about comment handling. Of course I assumed Notepad++ would strip comments lexically, replacing them by an empty string, and only then apply mainExpr, but it seems not to be the case.

                For my situation and needs I prefer to disable commentExpr at all, and do the other minor improvements written in my comments. I do get all functions, and do not get false functions. Reasoning, I do not have functions inside comments, and I do not place comments in function headers except between ) and { . Besides that, functions temporarely commented out, may still count as functions.
                At least the <parser> above is a partial proposal to my and other’s issues.

                By the way do you have an idea how to remove the mis-written earlier posts. I was not fluent with this BB and with markup language, and is there a preview?

                MAPJe71M 1 Reply Last reply Reply Quote 0
                • MAPJe71M Offline
                  MAPJe71 @t12122013 Fink
                  last edited by

                  @t12122013-Fink

                  how to remove the mis-written earlier posts

                  Use delete in the three-dots menu right next to ^ 0 v .

                  is there a preview?

                  As soon as you hit reply to open the edit pane you get either a preview pane on the right or a show preview option in the top right corner of the edit pane.

                  1 Reply Last reply Reply Quote 0
                  • t12122013 FinkT Offline
                    t12122013 Fink
                    last edited by t12122013 Fink

                    I’m only allowed to delete within 180 seconds. And today I get the preview, but yesterday there was none (preview availability depends on browser window width) . The BB is not easy but I’m motivated.

                    About the issue, I propose to disable commentExpr because of the following cases:

                    function setdata(x,y,z,w) // set coordinates x y z w

                    function setdata(x,y,z,w) /* set coordinates x y z w */

                    Functionlist will detect the function if there are two spaces between ) and the comment, but will not detect the function if there is just one space. My mainExpr as above given, stops after ) and does not eat one space.

                    1 Reply Last reply Reply Quote 0
                    • maroonmoon13M Offline
                      maroonmoon13 @David Liang
                      last edited by

                      @David-Liang Doesn’t work :(

                      1 Reply Last reply Reply Quote 0
                      • astrominionA Offline
                        astrominion
                        last edited by

                        i have problem too with Javascript functionList. I change the langID=58 (L_JAVASCRIPT) to langID=19 (L_JS) at :

                        <association id= “javascript_function” langID=“19” />

                        and it work verywell.

                        1 Reply Last reply Reply Quote 0
                        • Jonathan HJ Offline
                          Jonathan H
                          last edited by

                          This was bothering me for a while - turns out that even though I tick “don’t use roaming profiles” when installing, it still does so.
                          And the old config file was from 2016. So I simply copied the new version over from the notepad install dir and everything is OK now!

                          1 Reply Last reply Reply Quote 0
                          • pete312P Offline
                            pete312
                            last edited by pete312

                            I recovered from this problem by uninstalling notepad++ and then renaming what was left in Program Files to oldNotepad++, then reinstalling notepad++. Something obviously is out of whack.

                            Takes less time this way

                            1 Reply Last reply Reply Quote 0

                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                            With your input, this post could be even better 💗

                            Register Login
                            • First post
                              Last post
                            The Community of users of the Notepad++ text editor.
                            Powered by NodeBB | Contributors