VSCode-如何仅在javascript文件中更改常量的颜色?

时间:2020-05-15 22:17:24

标签: visual-studio-code

随着对vscode的最新更新,我终生无法找到将其恢复为旧颜色的设置。似乎所有常量都已更改为该绿色,而常规变量保持不变。谢谢

enter image description here

2 个答案:

答案 0 :(得分:1)

将此添加到主题的settings.json中

"editor.semanticTokenColorCustomizations": {
    "enabled": true, // enable semantic highlighting for all themes
    "rules": {
        "*.readonly": { "foreground": "#9cdcfe" },
        "*.declaration": { "foreground": "#9cdcfe" }
    }
}

答案 1 :(得分:0)

不确定如何仅对 .js 文件执行此操作,但此设置仅更改常量而不是所有声明。将此粘贴到您的 VsCode settings.json

"editor.tokenColorCustomizations": {
        "textMateRules": [
          {
            "scope": "variable.other.constant",
            "settings": {
              "foreground": "#f5f5f5"
            }
          }
        ]
    },