微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在VS代码中分别更改注释和块注释颜色

如何解决在VS代码中分别更改注释和块注释颜色

我试图找出如何为单行注释指定一种颜色,为块注释(多行)指定另一种颜色。

以下适用于将所有评论设置为某种颜色:

"editor.tokenColorCustomizations": {
        "comments" :"#ff0022",}

有没有办法单独指定它们?例如"blockComment" : "#00FF00","commentLine" : "#FF00222"

解决方法

使用 "textMateRules""comment.block" 设置范围设置,"comment.line" 可以单独设置颜色。

"editor.tokenColorCustomizations": {
    "textMateRules": [{
        "scope": "comment.block","settings": {
            "foreground": "#0000"
        }
    },{
        "scope": "comment.line","settings": {
            "foreground": "#0000FF"
        }
    }],}

Javascript

要更改标点符号 "punctuation.definition.comment.js" (js):

"editor.tokenColorCustomizations": {
    "textMateRules": [{
        "scope": "comment.line,punctuation.definition.comment.js","settings": {
            "foreground": "#00FF00"
        }
    }]
}

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。