无法在PHP的VSCode中更改DocBlock注释颜色

时间:2020-10-03 06:43:46

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

我到处都是,但是没有运气。我的VS Code主题中的DocBlock注释具有3种不同的颜色(请参见屏幕截图)。我希望所有颜色都是灰色(只有1种颜色)。我意识到这取决于主题本身(我正在使用Action[type='add'])。我该如何更改它,以使注释文本变成一种颜色(灰色)?

我可以使用此设置更改javascript的DockBlock注释,但它仅适用于Atom One Dark而不适用于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"
                }
            }
        ],
    },

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

Image of Yaktocat

1 个答案:

答案 0 :(得分:0)

由于@ rioV8,我能够准确地实现我想要的。因此,如果其他人正在寻找解决方案,我将分享我的settings.json

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

这是我的settings.json (用于JavaScript和PHP注释)

"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"
                }
            },
        ],
    }