Function list tuning



  • Notepad++ has a build-in FunctionList these days which can not be disabled. What you can do is install the Customize Toolbar-plugin and use it to remove the button from the task-bar.

    The images in the FunctionList tree view can not be changed by settings. You’ll have to change and rebuild Notepad++ to accomplish that. The images of the FunctionList-plugin (be aware that it has instability issues) and the SourceCookifier-plugin can be customized with settings.

    The parsers of FunctionList (build-in) and FunctionList-plugin are defined in FunctionList.xml and FunctionListRules.xml respectively and are not directly exchangeable.



  • Where to change regex to avoid this malfunction showed in the images? I think that the problem is here:

    mainExpr="^[\s]*(class|abstract[\s]+class|final[\s]+class)[\t ]+[\w]+([\s]*|[\s]*(extends|implements)[\s]+[\w\]+[\s]*)?\{"
                    openSymbole = "\{"
                    closeSymbole = "\}"
                    displayMode="node">
    

    Please help me to change the code to match } with nothing after the bracket. closeSymbole = "\}" is addet but when it is not have some space or symbol after

    class PHP {
    
    } //here it is not show function list and no clas there because is not match the regular expresion.
    

    Image 1 the cursor is ok and function list showed matches!

    Image 2 the cursor is NOT ok and function list is not showed matches!



  • The required trailing space is most probably a bug and might be related to or is the same bug as the required two spaces before an inline comment.



  • How can i modifed this?



  • Duh … if you have any C/C++ knowledge by improving the Notepad++ source code. Otherwise I’d opt for adding a bug-report (i.e. issue) on Notepad++'s GitHub page.



  • Man the regular expresion for PHP is bad not the exe file. Just we can make changes and improove it. I show here in images the problem.



  • Yes, there is a problem with the regular expression in your first post but correcting that will not solve the problem of the required space after the closing curly-brace.

    The closing curly-brace requires a white-space after it. This is a BUG in the Notepad++ source code. It can NOT be solved by changing the regular expression of the parser.

    This is what I used as the PHP parser:

          <parser
              id         ="php_syntax" 
              displayName="PHP" 
              commentExpr="(?'MLC'(?s-m)/\*.*?\*/)|(?'SLC'(?m-s)(?:#|/{2}).*$)|(?'STRLIT'(?s-m)&quot;[^&quot;\]*(?:\\.[^&quot;\]*)*&quot;|&apos;[^&apos;\]*(?:\\.[^&apos;\]*)*&apos;)"
              version    ="0.0.0.0" 
            >
            <classRange
                mainExpr    ="^\s*(?:(?-i:abstract|final)\s+)?(?-i:class)[\t ]+[A-Za-z_\x7f-\xff][\w\x7f-\xff]*(\s+(extends|implements|extends\s+(\\|[A-Za-z_\x7f-\xff][\w\x7f-\xff]*)+\s+implements)\s+(,\s*|(\\|[A-Za-z_\x7f-\xff][\w\x7f-\xff]*))+)?\s*\{"
                openSymbole ="\{"
                closeSymbole="\}"
              >
              <className>
                <nameExpr expr="(?:(?-i:abstract|final)\s+)?(?-i:class)[\t ]+[A-Za-z_\x7f-\xff][\w\x7f-\xff]*" />
                <nameExpr expr="\s+[A-Za-z_\x7f-\xff][\w\x7f-\xff]*\Z" />
                <nameExpr expr="[A-Za-z_\x7f-\xff][\w\x7f-\xff]*\Z" />
              </className>
              <function mainExpr="\s*(?:(?-i:static|public|protected|private|final)*(\s+(?-i:static|public|protected|private|final))+\s+)?(?-i:function\s+)([A-Za-z_\x7f-\xff][\w\x7f-\xff]*(\s+[A-Za-z_\x7f-\xff][\w\x7f-\xff]*)?(\s+|\*\s+|\s+\*|\s+\*\s+))?([A-Za-z_\x7f-\xff][\w\x7f-\xff]*\s*:{2})?(?:\b(?!(?-i:if|while|for|switch)\b))[A-Za-z_\x7f-\xff][\w\x7f-\xff]*\s*\([^\{]*\{" >
                <functionName>
                  <funcNameExpr expr="(?:\b(?!(?-i:if|while|for|switch)\b))[A-Za-z_\x7f-\xff][\w\x7f-\xff]*\s*\([^{]*" />
                  <!-- comment out the following node to display the method with its parameters -->
                  <funcNameExpr expr="[A-Za-z_\x7f-\xff][\w\x7f-\xff]*" />
                </functionName>
              </function>
            </classRange>
            <function mainExpr="\s*function\s+\w+\(" >
              <functionName>
                <nameExpr expr="(?!(?-i:if|while|for)\b)~?[A-Za-z_]\w*\s*\(" />
                <nameExpr expr="~?[A-Za-z_]\w*" />
              </functionName>
              <className>
                <nameExpr expr="\w+(?=\s*:{2})" />
              </className>
            </function>
          </parser>
    

    NOTE: it still won’t solve your problem i.e. it also requires a white-space after the closing curly-brace.



  • Is yours regular expression is better than my? If so what is better and what is better coincide with it? What are the differences between yours and mine?



  • I guess you’re smart enough to figure that out for yourself.



  • this is very helpful i’m looking on dev-ing a website for some microsoft guy and he is trying to figure out the proper way for notepad++ for shopping.


Log in to reply