有没有办法在 Visual Studio Code 中将注释斜体化? [英] Is there a way to italicize comments in Visual Studio Code?

查看:65
本文介绍了有没有办法在 Visual Studio Code 中将注释斜体化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Visual Studio Code 1.11.2 版.我需要能够看到任何语言文件中的斜体注释,或者至少是 JavaScript、Python、C 和 C++.是否有通用设置,或者我目前是否可以通过编程方式实现这一点?

I'm using Visual Studio Code version 1.11.2. I need to be able to see italicized comments in any language file, or at least JavaScript, Python, C, and C++. Is there a general setting for that or is there a programmatic way I can achieve that at the moment?

推荐答案

感谢 Victor 为我指明了正确的方向.把它放在我的设置文件(Visual Studio Code 1.42.1)中就可以了:

Thanks for pointing me in the right direction Victor. Putting this in my settings file (Visual Studio Code 1.42.1) did the trick:

"editor.tokenColorCustomizations": {
  "textMateRules": [
    {
      "scope": "comment",
      "settings": {
        "fontStyle": "italic"
      }
    }
  ]
}

您可以通过按 ctrl/cmd + shift + p 并查找 Developer: Inspect Editor Tokens and Scopes 来查看选择器范围.

You can see selector scopes by pressing ctrl/cmd + shift + p, and looking for Developer: Inspect Editor Tokens and Scopes.

您可以通过提供数组将设置应用于多个范围:

You can apply settings to multiple scopes by providing an array:

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

相关:如何让 Visual Studio Code 在格式化代码中显示斜体?

这篇关于有没有办法在 Visual Studio Code 中将注释斜体化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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