如何折叠/展开PhpStorm中文件中的所有注释块?

pro*_*mer 6 php comments docblocks collapse phpstorm

在PhpStorm中,什么是折叠或扩展文件中所有注释(doc)块的快速方法?

这里的文档中它说:

Folding and expanding code blocks works for entire classes, inner and
anonymous classes, method bodies, import lists, comments, HTML and XML tags,
closures and language injections.

然后进一步说:

If you hold the Alt modifier and click a toggle button in the gutter, the code block
will be collapsed or expanded recursively, i.e. all sub-blocks within the parent 
block will also be collapsed or expanded.

但是我没看到这是如何Alt modifer工作的?我按住Alt然后单击切换按钮,只有该块单独折叠.我在顶级doc块中以及属性/方法doc块中尝试了这个.我错过了什么吗?

Laz*_*One 17

在PhpStorm中,什么是折叠或扩展文件中所有注释(doc)块的快速方法?

代码| 折叠| 折叠/展开文档评论

在此输入图像描述

默认情况下,它没有快捷方式,但可以轻松添加到"设置"(Mac上的"首选项")中 外观与行为| 键盘映射 - 您想要的任何快捷键.


但是我没看到这是如何Alt modifer工作的?我按住Alt然后单击切换按钮,只有该块单独折叠.我在顶级doc块中以及属性/方法doc块中尝试了这个.我错过了什么吗?

是.

递归是什么意思?

它意味着嵌套的结构也可以折叠.

我的意思是,当我点击切换时,无论它是什么,一切都会折叠.按Alt不会有任何不同.

真?

示例代码:

<?php
class SomeClass
{
    public static function makeImageName($id, $sequence = 0, $sizeId = '')
    {
        $group = floor($id / 100);

        if ((int)$sequence > 0) {
            $suffix = '-' . $sequence . $sizeId;
        }
        else {
            $suffix = $sizeId;
        }

        return "/catalog/product/{$group}/{$id}/{$id}{$suffix}.jpg";
    }
}
Run Code Online (Sandbox Code Playgroud)

Alt + Click函数节点上之后:

在此输入图像描述

现在通过"normal"将该函数展开Click:

在此输入图像描述

正如你可以清楚地看到ifelse 嵌套块仍在崩溃.