3

VSCode代码编辑器中,默认的注释是以斜体显示,注释中的中文看起来很不舒服,所以想把斜体去掉。

从网上找了几篇相关的文章,都是从扩展的主题中修改,这样很不方便,一旦切换主题,修改就失效了。

通过Google搜索了一下,找了篇国外的文章,才找到了正确定的设置方法如下:

在VSCode设置文件setting.json中,添加如下代码:

"editor.tokenColorCustomizations": {
  "textMateRules": [
    {
      "name": "Comment",
      "scope": [
        "comment",
        "comment.block",
        "comment.block.documentation",
        "comment.line",
        "comment.line.double-slash",
        "punctuation.definition.comment",
      ],
      "settings": {
        "fontStyle": "",
        //斜体 "fontStyle": "italic",
        //斜体下划线 "fontStyle": "italic underline",
        //斜体粗体下划线 "fontStyle": "italic bold underline",
      }
    },
  ]
},

你会发现,一切都搞定了,如果希望设置成其他样式,也都是可以的,而且这样即使更换主题,也不会影响注释的设置。


行者
12 声望0 粉丝