VS Code: How to make all text bold, except the comments? [closed]

跟風遠走 提交于 2019-12-11 06:17:51

问题


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.


回答1:


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:

  • 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": ""
            }
        }]
    }

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.



来源:https://stackoverflow.com/questions/53996258/vs-code-how-to-make-all-text-bold-except-the-comments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!