The list of Notepad ++ PHP functions does not work unless I close the PHP tag

I want to use the function list function from notepad ++ for my PHP code Actually, the function list works fine if I write a PHP tag (?>). But if I did not close the PHP tag, the list of functions does not work.

I just want the list of functions still working, even I didn’t close the PHP tag

See image Above without a PHP tag. At the bottom is a PHP tag with a tag.

enter image description here

Then I read this, notepad + doc function list block https://notepad-plus-plus.org/features/function-list.html

I think I need to edit the regex. But the problem is that I cannot edit the regex because the regex looks too complicated for me.

This is a regular expression and xml list of PHP functions

<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

thanks

+5
source share
4 answers

[solvable]

We just need to add an input line / add a new line after closing the class or function tag

So maybe this is a mistake

thanks

+6
source

For me, the problem was that there was no closing PHP tag.

Maybe this helps someone.

Add the closing PHP tag "?>" If it does not already exist.

+1
source

The internal "list of functions" does not work for me at all. I tried to delete one or both of the functionslist.xml files, which was recommended on some sites, but nothing worked for me.

I prefer the plugin "functionList" from https://sourceforge.net/projects/npp-plugins/files/Function%20List/

with fix from https://github.com/gwarnants/FunctionList-PHP-Patch

which works great with my Notepad ++ 6.9.2

0
source

There are several reasons why a function list cannot display a function tree.

  • In older versions of the Notepad Bookmark tab, PHP is required. Just add ?> the end of the file. Sometimes a new line is required after closing the tab.
  • functionList.xml invalid parsing of PHP file. For example, this function description has broken a list of functions:
  / **
      * 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 to% APPDATA% (There are two directories functionsList.xml. Program Files and% APPDATA% directory)

 <parser id ="php_syntax" displayName="PHP" commentExpr="(?'MLC'(?sm)/\*.*?\*/)|(?'SLC'(?ms)(?:#|/{2}).*$)|(?'STRLIT'(?sm)&quot;[^&quot;\\]*(?:\\.[^&quot;\\]*)*&quot;|&apos;[^&apos;\\]*(?:\\.[^&apos;\\]*)*&apos;)" > 
0
source

Source: https://habr.com/ru/post/1241886/


All Articles