2017-04-27 185 views

回答

5

感谢您指出我在正确的方向胜者。我想摆脱针对某个主题的斜体注释并将其放入我的设置文件(Visual Studio Code 1.16。0)的伎俩:

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

在你的情况,阿曼尼,与italic

+0

这在任何主题中都可以更容易地完成和工作,谢谢。 – Amani

3

是的,有办法做到这一点。

这个答案适用于Microsoft Windows [版本10.0.14393],Visual Studio代码1.14.2

如果您使用的是安装的主题从扩展的市场,他们的文件位于C:\Users\<YourUsername>\.vscode\extensions\

让我们说你正在使用Kal.theme-glacier。主题文件是这样的:

C:\Users\<YourUsername>\.vscode\extensions\Kal.theme-glacier-0.0.1\themes\glacier.tmTheme

编辑(建议使用记事本+ +)在任何文本编辑器中的文件
视觉在编辑主题文件,或者您可能需要重新启动VS码Studio代码不应该运行。

找到钥匙名称Comment并将FontStyle更改为italic。代码的最后一块应该是这样的:

<dict> 
    <key>name</key> 
    <string>Comment</string> 
    <key>scope</key> 
    <string>comment</string> 
    <key>settings</key> 
     <dict> 
      <key>fontStyle</key> 
      <string>italic</string> 
      <key>foreground</key> 
      <string>#515c68</string> 
     </dict> 
</dict> 

如果您使用的是默认的主题(从扩展市场没有安装),则该位置是在这里:

C:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\theme-<name>

假设您使用Light +(默认灯光)主题。

你想看看第一个文件是
C:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\theme-defaults\themes\light_plus.json

你会发现有一个在这里没有Comment关键,但你会发现"include": "./light_vs.json"那么这就是你想要编辑实际文件。
C:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\theme-defaults\themes\light_vs.json最后一块应该是这样的:

{ 
    "scope": "comment", 
    "settings": { 
     "foreground": "#009000", 
     "fontStyle": "italic" 
    } 
}, 
+0

'在任何文本编辑器(记事本++推荐)编辑文件'''或者您可能需要重启VS-Code'好吧,我想我可以做到这一点。 –

0

一个更完整的答案是在VS代码Github的问题跟踪 https://github.com/Microsoft/vscode/issues/32579#issuecomment-341502559

贴例如更换normal

punctuation.definition.comment对创建注释的字符(如://和其他)禁用斜体。

"editor.tokenColorCustomizations": { 
    "textMateRules": [ 
     { 
      "scope": [ 
       "comment", 
       "punctuation.definition.comment", 
       "variable.language" 
      ], 
      "settings": { 
       "fontStyle": "" 
      } 
     } 
    ] 
} 
相关问题