Function list tuning



  • How can i change this function list images?
    Image to list
    However i have and problem with regex of the PHP classes in functionList.xml
    When I create class have always after the closing bracket (}) to set character (}) for matcha is the content of the class.

    <parser id="php_function" displayName="PHP" commentExpr="((/\*.*?\*)/|(//.*?$))">
                <classRange
                    mainExpr="^[\s]*(class|abstract[\s]+class|final[\s]+class)[\t ]+[\w]+([\s]*|[\s]*(extends|implements)[\s]+[\w\]+[\s]*)?\{"
                    openSymbole = "\{"
                    closeSymbole = "\}"
                    displayMode="node">
                    <className>
                        <nameExpr expr="(class|abstract[\s]+class|final[\s]+class)[\s]+[\w]+"/>
                        <nameExpr expr="[\s]+[\w]+\Z"/>
                        <nameExpr expr="[\w]+\Z"/>
                    </className>
                    <function
                        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]*\([^\{]*\{">
                        <functionName>
                            <funcNameExpr expr="(?!(if|while|for|switch))[\w_]+[\s]*\([^\{]*"/>
                            <!-- comment below node if want display method with parmas -->
                            <funcNameExpr expr="(?!(if|while|for|switch))[\w_]+"/>
                        </functionName>
                    </function>
                </classRange>
                <function
                    mainExpr="^[\s]*function[\s]+\w+\("
                    displayMode="$className->$functionName">
                    <functionName>
                        <nameExpr expr="(?!(if|while|for))[\w_]+[\s]*\("/>
                        <nameExpr expr="(?!(if|while|for))[\w_]+"/>
                    </functionName>
                    <className>
                        <nameExpr expr="[\w_]+(?=[\s]*::)"/>
                    </className>
                </function>
            </parser>


  • What do you want the FunctionList to look like?

    You have to define the opening and closing symbol of the class so FunctionList can determine the scope of the class and search for member functions i.e. methods.



  • I want to make changes in the default images. New Notepad++ v6.7.8.2 and there is default function list button in the tab. I seee in internet plugin for function list and its looking good but he add me a new function list button in tab and they are twoo.This is look very good
    https://github.com/gwarnants/FunctionList-PHP-Patch i add it but when makes another button i delete it because i want to change default function list and not make another.

    Image

    I do it but when after the closing bracket } have no symbol or space it is not match the regex and appears to don’t have class in the file.



  • 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