如果我没有关闭 PHP 标签,Notepad++ 函数列表 PHP 不工作

Notepad++ function list PHP not working if I didn't close the PHP tag

我想为我的 PHP 代码使用 notepad++ 中的函数列表功能 实际上,如果我写关闭 PHP 标签( ?> ),函数列表可以正常工作。但是如果我没有关闭 PHP 标签,函数列表将无法正常工作

我只是想,即使我没有关闭 PHP 标签,功能列表仍然有效

查看图片 顶部没有关闭 PHP 标签 底部是关闭 PHP 标签

然后我看了这个,notepad++函数列表文档 https://notepad-plus-plus.org/features/function-list.html

我想,我需要编辑正则表达式..但问题是我无法编辑正则表达式,因为正则表达式对我来说太复杂了

这是PHP函数列表

的正则表达式和xml
<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>

谁能帮帮我

谢谢

[已解决]

我们只需要在关闭 class 或函数标签

后添加 enter/add 新行

所以这可能是一个错误

谢谢

内部 "function list" 对我根本不起作用。我尝试删除一个或两个 "functionlist.xml" 文件,这在某些网站上被推荐,但对我没有任何效果。

我更喜欢来自 "functionList" 的插件 https://sourceforge.net/projects/npp-plugins/files/Function%20List/

补丁来自 https://github.com/gwarnants/FunctionList-PHP-Patch

非常适合我的 Notepad++ 6.9.2

对我来说,问题是没有结束 PHP 标签。

可能对某人有帮助。

添加一个“?>”结束 PHP 标签(如果它还没有)。

函数列表无法渲染函数树的原因有多种。

  1. 在旧版本的 Notepad++ 中 PHP 部分关闭标签是必需的。只需在文件末尾添加 ?> 即可。有时在关闭选项卡后需要换行。
  2. functionList.xml 不正确的解析 PHP 文件。例如这个函数描述破坏了函数列表渲染:
    /**
     * Unset an instance of this class.
     *
     * @param Spreadsheet $spreadsheet Injected spreadsheet identifying the instance to unset
     */
    public function __destruct()
    {
        $this->workbook = null;
    }

在这种情况下,您必须更改(或添加)commentExpr In functionList.xml in %APPDATA% (有两个 functionList.xml 位置。Program Files 目录和 %APPDATA% 目录)

<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;)"
>

替换 functionList.xml 中的 php 解析器。使用您可以在 notepad++ 论坛中找到的这个新的 ->

https://notepad-plus-plus.org/community/topic/15124/php-function-list-and-abstract-functions/17

它可以处理抽象 class 和函数。