英文:
Vscode """ """ string when comment color somehow got turned to dark green
问题
有一天,当注释颜色不知何故变成深绿色时,字符串颜色保持为浅橙色。
我尝试在设置中更改注释的颜色,但它只影响#注释。
"editor.fontLigatures": false,
"workbench.colorTheme": "Default Dark+",
"editor.tokenColorCustomizations":{
    "comments":"#a1b876",
}
如何将“”“”“”字符串的颜色更改为自定义颜色,或至少更改为普通字符串颜色?
英文:
One day, the color """ """ string when comment color somehow got turned to dark green.
While the string color remain light orange.
I had try to change comments' color in settings, but it only effect the # comment.
"editor.fontLigatures": false,
"workbench.colorTheme": "Default Dark+",
"editor.tokenColorCustomizations":{
    "comments":"#a1b876",
}
how do I change the color of """ """ string when comment to custom color or at least normal string color?
答案1
得分: 0
"""" is not a comment, it's still a string."
关于为什么图片中的两个三重引号字符串颜色不同,是因为 hhh 被识别为文档字符串。
您可以使用以下设置更改颜色:
"editor.tokenColorCustomizations": {
    "[Default Dark+]": {
        "textMateRules": [
            {
                "name": "docstring",
                "scope": "string.quoted.docstring.multi.python",
                "settings": {
                    "foreground": "#FF0000"
                }
            },
            {
                "name": "string",
                "scope": "string.quoted.multi.python",
                "settings": {
                    "foreground": "#0de711"
                }
            }
        ]
    }
}
英文:
""" is not a comment, it's still a string.
As for why the two triple-quote strings in the picture have different colors, because hhh is recognized as a docstring.
You can change the color with the following settings
    "editor.tokenColorCustomizations": {
        "[Default Dark+]": {
            "textMateRules": [
                {
                    "name": "docstring",
                    "scope": "string.quoted.docstring.multi.python",
                    "settings": {
                        "foreground": "#FF0000"
                    }
                },
                {
                    "name": "string",
                    "scope": "string.quoted.multi.python",
                    "settings": {
                        "foreground": "#0de711"
                    }
                }
            ]
        }
    }
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。




评论