【问题标题】:How to Fix "End of File Expected" JSON Settings VS Code?如何修复“预期文件结尾”JSON 设置 VS 代码?
【发布时间】:2021-05-29 03:36:05
【问题描述】:
{
    
"workbench.colorTheme": "Default Dark+"

}

{ }
   
"name": "C++ Launch",
    
"type": "cppdbg",

    "request": "launch",
    "program": "${workspaceFolder}/a.out",
    "stopAtEntry": false,
    "customLaunchSetupCommands": [
      { "text": "target-run", "description": "run target", "ignoreFailures": false }
    ],
    "launchCompleteCommand": "exec-run",
    "linux": {
      "MIMode": "gdb",
      "miDebuggerPath": "/usr/bin/gdb"
    },
    "osx": {
      "MIMode": "lldb"
    },
    "windows": {
      "MIMode": "gdb",
      "miDebuggerPath": "C:\\MinGw\\bin\\gdb.exe"
    }
  }

【问题讨论】:

  • 顺便说一句。为什么你的 json 中有 { } 而最后一个 } 根本没有 {。

标签: c++ json visual-studio-code


【解决方案1】:

您发布的内容不是有效的 json。您有几个拼写错误,包括:

  • 第 7 行的一组空花括号 {},后跟几个未包含在花括号中的键值属性对。

这可能更接近你想要的:

{
  "workbench.colorTheme": "Default Dark+",
  "name": "C++ Launch",
  "type": "cppdbg",
  "request": "launch",
  "program": "${workspaceFolder}/a.out",
  "stopAtEntry": false,
  "customLaunchSetupCommands": [
    {
      "text": "target-run",
      "description": "run target",
      "ignoreFailures": false
    }
  ],
  "launchCompleteCommand": "exec-run",
  "linux": {
    "MIMode": "gdb",
    "miDebuggerPath": "/usr/bin/gdb"
  },
  "osx": {
    "MIMode": "lldb"
  },
  "windows": {
    "MIMode": "gdb",
    "miDebuggerPath": "C:\\MinGw\\bin\\gdb.exe"
  }
}

【讨论】:

  • 谢谢,这真的很有帮助。我现在明白了。
猜你喜欢
  • 2022-01-16
  • 1970-01-01
  • 1970-01-01
  • 2015-12-12
  • 2019-09-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多