使用注解调试json

pcww981p  于 2023-02-17  发布在  其他
关注(0)|答案(1)|浏览(179)

我正在创建一个VScode主题,我有一个很长的json文件,如下所示:

{
    "name": "mytheme",
    "type": "dark",
    "colors": {
        //////////////////////////////
        // CONTRAST COLOR 
    // The contrast colors are typically only set for high contrast themes. 
    // If set, they add an additional border around items across the UI to increase the contrast.
    //////////////////////////////
        // An extra border around active elements to separate them from others for greater contrast.
        // "contrastActiveBorder": "#FFFFFF00",
        // An extra border around elements to separate them from others for greater contrast.
        // "contrastBorder": "#FFFFFF00",

    //////////////////////////////
    // BASE COLORS 
    //////////////////////////////
    // Overall border color for focused elements. This color is only used if not overridden by a component.
    "focusBorder": "#aa6DFF66",
    // Overall foreground color. This color is only used if not overridden by a component.
    "foreground": "#aaE0E8",
    // Shadow color of widgets such as Find/Replace inside the editor.
    "widget.shadow": "#112330",
    // Background color of text selections in the workbench (for input fields or text areas, does not apply to selections within the editor and the terminal).
    "selection.background": "#9B6DFF99",
    // Foreground color for description text providing additional information, for example for a label.
    "descriptionForeground": "#808182",
    // Overall foreground color for error messages (this color is only used if not overridden by a component).
    "errorForeground": "#9B6DFF",
    // The default color for icons in the workbench.
    "icon.foreground": "#D9E0E8",
    ...

我想试试,所以我按照这篇官方文章。它说按f5打开扩展开发主机窗口。如果我按f5,我得到这个弹出

You don't have an extension for debugging 'JSON with Comments'. Should we find a 'JSON with Comments' extension in the Marketplace?
如果按“查找”或“取消”,则无法打开“扩展开发主机”窗口。
当我打开package.json文件(没有注解)时,我试着按下f5键,但结果是一样的。我如何调试一个有注解的json文件?
删除注解不是一个选项,它是一个非常长的文件,注解使它可读和可理解。

8fq7wneg

8fq7wneg1#

已解决在.vscode文件夹中创建此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"
      ],
    },
  ]
}

相关问题