I want to use function list feature from notepad++ for my PHP code Actually the function list is working normally if I write the close PHP tag ( ?> ).. But if I didn't close the PHP tag, the function list is not working
I just want, the function list is still working even I didn't close the PHP tag
See the image On the top is without close PHP tag On the bottom is with close PHP tag
Then I read this, notepad++ function list doc https://notepad-plus-plus.org/features/function-list.html
I guess, I need to edit the regex.. But the problem is I can't edit the regex because the regex looks like too complex for me
This is the regex and xml of PHP function list
<parser id="php_function" displayName="PHP" commentExpr="((/\*.*?\*)/|(//.*?$))">
<classRange
mainExpr="^[\s]*(class|abstract[\s]+class|final[\s]+class)[\t ]+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*([\s]*|[\s]*(extends|implements|(extends[\s]+(\\|[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+[\s]+implements))[\s]+(\,[\s]*|(\\|[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))+[\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>
Can someone help me
Thank you
[Solved]
We just need to add enter/add new line after close the class or function tag
So maybe this is a bug
Thanks
For me the problem was that there was no closing PHP tag.
May be that helps someone.
Add a "?>" closing PHP tag if it is already not there.
There are several reasons why function list can't render function tree.
?>
at the end of file. Sometimes after closing tab new line is required. /** * Unset an instance of this class. * * @param Spreadsheet $spreadsheet Injected spreadsheet identifying the instance to unset */ public function __destruct() { $this->workbook = null; }
In this case you must change (or add) commentExpr
In functionList.xml in %APPDATA%
(There are two functionList.xml locations. Program Files directory and %APPDATA% directory)
<parser
id ="php_syntax"
displayName="PHP"
commentExpr="(?'MLC'(?s-m)/\*.*?\*/)|(?'SLC'(?m-s)(?:#|/{2}).*$)|(?'STRLIT'(?s-m)"[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')"
>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With