如何collapse/expand PhpStorm 文件中的所有注释块?

How to collapse/expand all comment blocks in a file in PhpStorm?

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

在文档中 here 它说:

折叠和扩展代码块适用于整个 classes,内部和
匿名 classes、方法体、导入列表、注释、HTML 和 XML 标签,
闭包和语言注入。

然后再往下说:

如果您按住 Alt 键并单击装订线中的切换按钮,代码块
将递归折叠或展开,即父级中的所有子块
块也将折叠或展开。

但我没有看到 Alt modifer 是如何工作的?我按住 Alt 然后单击切换按钮,只有那个块单独折叠。我在顶部 class 文档块和 property/method 文档块中尝试了这个。我错过了什么吗?

In PhpStorm, what is a quick way to collapse or expand all the comment (doc) blocks in a file?

代码 |折叠 | Collapse/Expand 文档评论

默认情况下它没有快捷方式,但可以很容易地在设置中添加(Mac 上的首选项)|外观与行为 | Keymap -- 你想要的任何快捷方式。


But I'm not seeing how this Alt modifer works? I hold Alt then click the toggle button and only that block alone collapses. I tried this in the top class doc block, and also in the property/method doc blocks. Am I missing something?

是的。

What does it mean by recursively?

这意味着 嵌套结构 也可以折叠。

I mean, when I click the toggle, everything folds, no matter what it is. Pressing Alt does nothing differently.

真的吗?

示例代码:

<?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";
    }
}

在函数节点上 Alt + 单击之后:

现在通过 "normal" 点击:

扩展该功能

您可以清楚地看到 ifelse 嵌套的 块仍然折叠。