VS Code颜色主题调试

时间:2018-05-14 14:31:31

标签: visual-studio-code vscode-extensions vs-color-theme-editor

VS Code编辑器未显示正确的主题。有时它工作,有时不工作,我无法弄清楚如何重现它。我卸载了VS Code并再次安装它,但我仍然无法调试自己的主题。

我用

创建了一个新的颜色主题
$ yo code

我选择了new color theme并选择了blank dark one

现在,当我启动调试器时,它会加载一个带有我主题的新编辑器。我可以在preferencescolor theme的菜单中选择它。

然后有时它不会应用所选的更改。

但是当我删除tokenColors: [...]中的所有内容时,我会再次选择颜色主题,但是当我在tokenColors中键入一些新主题并重新加载它时,它不会应用新样式。

我的猜测是VS Code正在缓存某个地方的样式而不会覆盖它。

问题是如果我无法调试它,如何开发新的颜色主题?

如何重新加载主题?

{
  "name": "T",
  "type": "dark",
  "colors": {
    "editorGroup.background": "#2b303b",
    "editorGroup.border": "#c0c5ce",
    "editor.background": "#2b303b",
    "editor.foreground": "#c0c5ce",
    "activityBarBadge.background": "#2b303b",
    "sideBar.background": "#1c1f26",
    "sideBar.foreground": "#c0c5ce",
    "list.hoverBackground": "#2b303b",
    "list.hoverForeground": "#c0c5ce",
    "list.activeSelectionForeground": "#c0c5ce",
    "list.inactiveSelectionForeground": "#c0c5ce",
    "list.activeSelectionBackground": "#2b303b",
    "list.inactiveSelectionBackground": "#2b303b",
    "sideBarTitle.foreground": "#c0c5ce",
    "sideBarSectionHeader.background": "#2b303b",
    "statusBar.background": "#1c1f26",
    "statusBar.foreground": "#c0c5ce",
    "tab.activeBackground": "#2b303b",
    "tab.inactiveBackground": "#1c1f26",
    "terminal.background": "#2b303b",
    "activityBar.border": "#1c1f26",
    "activityBar.background": "#2b303b",
    "sideBar.border": "#1c1f26",
    "tab.activeForeground": "#c0c5ce"
  },
  "tokenColors": [
    {
      // const, let, if, else, async, await, try, catch
      "name": "j",
      "scope": [
        "storage.type.js.jsx",
        "storage.modifier.async.js.jsx",
        "keyword.control.flow.js.jsx",
        "keyword.control.conditional.js.jsx",
        "keyword.control.trycatch.js.jsx"
      ],
      "settings": {
        "foreground": "#b48ead",
        "fontStyle": "italic"
      }
    }
  ]
}

1 个答案:

答案 0 :(得分:0)

您实际上可以使用VS Code调试器。

  1. 在vs代码中打开项目文件夹。
  2. 创建.vscode/文件夹(如果不存在)
  3. 在该文件夹中创建一个launch.json文件,并在文件中创建
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "extensionHost",
            "request": "launch",
            "name": "Launch Extension",
            "runtimeExecutable": "${execPath}",
            "args": [
                "--extensionDevelopmentPath=${workspaceFolder}"
            ],
            "outFiles": [
                "${workspaceFolder}/out/**/*.js"
            ],
        },
    ]
}
  1. 启动调试器(CMD / CTRL + D)
  2. 确保在打开的新窗口中选择主题
  3. 每次更改主题后重新加载调试器

单独发行

虽然以上是一般的调试方法,但尤其是该问题可能是tokenColors中添加的新作用域被更高优先级作用域覆盖了而没有出现。在不了解更多情况的情况下很难说出来。我认为VS Code不会将更改缓存到任何地方,完整的窗口重载应该总是从头开始。

相关问题