【问题标题】:Unable to change DocBlock comments color in VSCode for PHP无法在 VSCode for PHP 中更改 DocBlock 注释颜色
【发布时间】:2021-01-18 17:11:14
【问题描述】:

我找遍了整个地方,但没有运气。我的 VS Code 主题中的 DocBlock cmets 有 3 种不同的颜色(见截图)。我希望这一切都是灰色的(只有一种颜色)。我意识到这取决于主题本身(我使用的是Atom One Dark)。我该如何更改它以使评论文本为一种颜色(灰色)?

我能够使用此设置更改用于 javascript 的 DockBlock cmets,但它仅适用于 javascript,但不适用于 PHP

    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "name": "storage.type.class.jsdoc",
                "scope":
                "storage.type.class.jsdoc,entity.name.type.instance.jsdoc,variable.other.jsdoc",
                "settings": {
                    "foreground": "#5c6370"
                }
            }
        ],
    },

这也没用

    "editor.tokenColorCustomizations": {
        "comments": "#5c6370",
    },

屏幕截图(如您所见,我的 cmets 有 3 种颜色 - 灰色、紫色和黄色)

【问题讨论】:

  • 找到错误颜色部分的TextMate范围并将其添加到自定义中,php使用javascript以外的其他范围
  • @rioV8 我该怎么做,我不确定..?
  • 使用命令Developer: Inspect Editor Tokens and Scopes

标签: php visual-studio-code editor vscode-settings


【解决方案1】:

感谢@rioV8,我能够完全实现我想要的。因此,如果其他人正在寻找解决方案,我将分享我的 settings.json

我还了解到,您可以通过用空格分隔多个范围来选择它们。但是顺序很重要,看起来需要与检查编辑器显示的顺序相反。算了。。

这是我的settings.json(用于 javascript 和 PHP cmets)

"editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "storage.type.class.jsdoc,entity.name.type.instance.jsdoc,variable.other.jsdoc",
                "settings": {
                    "foreground": "#485c6c"
                }
            },

            {
                "scope": "storage.type.class.jsdoc punctuation.definition.block.tag.jsdoc",
                "settings": {
                    "foreground": "#485c6c"
                }
            },

            {
                "scope": "comment.block.documentation.phpdoc.php",
                "settings": {
                    "foreground": "#5c6370"
                }
            },

            {
                "scope": "keyword.other.phpdoc.php,comment.block.documentation.phpdoc.php",
                "settings": {
                    "foreground": "#76687d"
                }
            },

            {
                "scope": "keyword.other.type.php,meta.other.type.phpdoc.php,comment.block.documentation.phpdoc.php",
                "settings": {
                    "foreground": "#76687d"
                }
            },

            {
                "scope": "support.class.php",
                "settings": {
                    "foreground": "#E5C07B"
                }
            },

            {
                "scope": "meta.other.type.phpdoc.php,comment.block.documentation.phpdoc.php",
                "settings": {
                    "foreground": "#5c6370"
                }
            },

            {
                "scope": "meta.other.type.phpdoc.php support.class.php",
                "settings": {
                    "foreground": "#5c6370"
                }
            },
            
            {
                "scope": "meta.other.type.phpdoc.php support.class.builtin.php",
                "settings": {
                    "foreground": "#5c6370"
                }
            },
        ],
    }

【讨论】:

    猜你喜欢
    • 2022-11-08
    • 2011-10-22
    • 1970-01-01
    • 2011-12-31
    • 2023-03-21
    • 2016-08-29
    • 2021-12-27
    • 2021-07-29
    • 1970-01-01
    相关资源
    最近更新 更多