首页 > 解决方案 > 不允许使用属性字符串

问题描述

我正在更改我的主题属性,例如commentVS Code 中的前景色。

editor.tokenColorCustomizationssettings.json文件中使用。

"editor.tokenColorCustomizations": {
  "[Tinacious Design (legacy, 2016)]": {
    "comments": "#797979",
    "string": "#898989", 
  }    
}

颜色已comments完美更改,但是当我为该string值分配颜色时,它显示错误:

“不允许使用属性字符串。”

错误图像

标签: javascriptjsonvisual-studio-codethemesvscode-settings

解决方案


“字符串”关键字是保留名称,不能用于定义属性。有点像为什么你自己的名字不能给别人。设置字符串颜色的正确方法是

"strings": "//color Hex"

进一步阅读:https ://code.visualstudio.com/docs/getstarted/themes


推荐阅读