VS Code:如何使所有文本加粗,注释除外? [英] VS Code: How to make all text bold, except the comments?

查看:188
本文介绍了VS Code:如何使所有文本加粗,注释除外?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以在 VS Code 中使除注释之外的所有文本都粗体吗?
我试过使用 "editor.fontWeight": "bold" 但这会使所有内容,包括评论,都加粗.

Can we make all text except for comments appear bold in VS Code?
I've tried using "editor.fontWeight": "bold" but this makes everything, including comments, bold.

示例:在下面的屏幕截图中,除了注释(灰色)之外的所有文本都将是粗体.

Example: in the screenshot below, all text except for the comments (grey) would be bold.

推荐答案

为注释设置不同的字体或字体大小目前不是 VS Code 中的标准功能.

Setting different fonts or font size for comments is currently not a standard feature in VS Code.

但是,除了注释之外,您可以使用所有内容粗体:

You can however make everything except comments bold:

  • 打开 settings.json Ctrl+Shift+P →输入打开设置(JSON)"→回车)
  • 粘贴下面的条目并保存以将所有文本加粗,评论除外:
  • Open settings.json Ctrl+Shift+P → type 'Open Settings (JSON)' → Enter)
  • Paste in the entry below and save to make all text bold, except comments:

"editor.tokenColorCustomizations": {
        "textMateRules": [{
            "scope": [
                "constant",
                "constant.character",
                "constant.character.escape",
                "constant.numeric",
                "constant.numeric.integer",
                "constant.numeric.float",
                "constant.numeric.hex",
                "constant.numeric.octal",
                "constant.other",
                "constant.regexp",
                "constant.rgb-value",
                "emphasis",
                "entity",
                "entity.name",
                "entity.name.class",
                "entity.name.function",
                "entity.name.method",
                "entity.name.section",
                "entity.name.selector",
                "entity.name.tag",
                "entity.name.type",
                "entity.other",
                "entity.other.attribute-name",
                "entity.other.inherited-class",
                "invalid",
                "invalid.deprecated",
                "invalid.illegal",
                "keyword",
                "keyword.control",
                "keyword.operator",
                "keyword.operator.new",
                "keyword.operator.assignment",
                "keyword.operator.arithmetic",
                "keyword.operator.logical",
                "keyword.other",
                "markup",
                "markup.bold",
                "markup.changed",
                "markup.deleted",
                "markup.heading",
                "markup.inline.raw",
                "markup.inserted",
                "markup.italic",
                "markup.list",
                "markup.list.numbered",
                "markup.list.unnumbered",
                "markup.other",
                "markup.quote",
                "markup.raw",
                "markup.underline",
                "markup.underline.link",
                "meta",
                "meta.block",
                "meta.cast",
                "meta.class",
                "meta.function",
                "meta.function-call",
                "meta.preprocessor",
                "meta.return-type",
                "meta.selector",
                "meta.tag",
                "meta.type.annotation",
                "meta.type",
                "punctuation.definition.string.begin",
                "punctuation.definition.string.end",
                "punctuation.separator",
                "punctuation.separator.continuation",
                "punctuation.terminator",
                "storage",
                "storage.modifier",
                "storage.type",
                "string",
                "string.interpolated",
                "string.other",
                "string.quoted",
                "string.quoted.double",
                "string.quoted.other",
                "string.quoted.single",
                "string.quoted.triple",
                "string.regexp",
                "string.unquoted",
                "strong",
                "support",
                "support.class",
                "support.constant",
                "support.function",
                "support.other",
                "support.type",
                "support.type.property-name",
                "support.variable",
                "variable",
                "variable.language",
                "variable.name",
                "variable.other",
                "variable.other.readwrite",
                "variable.parameter"
            ],
            "settings": {
                "fontStyle": "bold"
            }
          },{
            "scope": [
                "comment",
                "punctuation.definition.comment"
            ],
            "settings": {
                "fontStyle": ""
            }
        }]
    }

如果您的 settings.json 不包含任何其他条目,只需将上述内容包装在 { } 中.
您可以在 此处阅读有关在 VS Code 中自定义编辑器文本的更多信息.

If your settings.json doesn't contain any other entries just wrap the above in { }.
You can read more about customizing the editor text in VS Code here.

这篇关于VS Code:如何使所有文本加粗,注释除外?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆