c++visual-studio-codeinput

Error in VSCode launch.json: "Inputs Property Not Allowed"


I'm developing ROS 2 nodes in C++ and trying to configure a dynamic debugging setup in VSCode using the inputs property in my launch.json. The intention is to enable selection of different nodes for debugging from a dropdown at the start of a debug session. However, VSCode is displaying an error saying "Inputs Property Not Allowed". According to Variables Reference, inputs is a valid property. I'm using VSCode version 1.84.2 and I'm unsure why this error is occurring or how to resolve it. Any insights or solutions would be appreciated.

[{    "resource": "/home/robot/vision_servo/.vscode/launch.json",    "owner": "_generated_diagnostic_collection_name_#1",    "severity": 4,    "message": "Inputs Property Not Allowed",    "startLineNumber": 23,    "startColumn": 7,    "endLineNumber": 23,    "endColumn": 15}]

Here is the relevant section of my launch.json:

{
  // ... other configuration settings ...
  "inputs": [
    {
      "id": "package",
      "type": "pickString",
      "description": "Package name",
      "options": ["camera_deal", "vision_control", "egm_control"],
      "default": "camera_deal"
    },
    {
      "id": "program",
      "type": "pickString",
      "options": ["camera_deal", "vision_control", "egm_control"],
      "default": "camera_deal"
    }
  ]
  // ... other configuration settings ...
}

I've checked the VSCode documentation and it seems inputs is a valid property. I'm using VSCode version 1.84.2. Any idea why this error is occurring or how to fix it?

I attempted to use the inputs property in my VSCode launch.json configuration file, hoping to dynamically gather package and program names from the user at the start of a debug session. According to the VSCode official documentation I consulted, this seemed like a valid configuration approach. I expected that when I started a debug session, VSCode would prompt me to enter this information.

However, in reality, after I added the inputs property, VSCode displayed an error message stating "Inputs Property Not Allowed". This left me puzzled, as to my knowledge, this should be a legitimate configuration. I checked for any JSON formatting errors and confirmed that I am using the latest version of VSCode, but the issue still persists. I haven't tried other methods yet, as I'm unsure where to start in addressing this problem.


Solution

  • I have solved the issue. The 'inputs' parameter needs to be on the same level as the 'configurations' and other parameters. Here is my modified json file:

    {
      "version": "0.2.0",
      "configurations": [
        {
          "name": "(gdb) Launch",
          "type": "cppdbg",
          "request": "launch",
          "program": "${workspaceFolder}/install/${input:package}/lib/${input:package}/${input:program}",
          "args": [],
          "stopAtEntry": true,
          "cwd": "${workspaceFolder}",
          "environment": [],
          "externalConsole": false,
          "MIMode": "gdb",
          "setupCommands": [
            {
              "description": "Enable pretty-printing for gdb",
              "text": "-enable-pretty-printing",
              "ignoreFailures": true
            }
          ],
        }
      ],
      "inputs":[
        {
          "id": "package",
          "type": "promptString",
          "description": "Package name"
        },
        {
          "id": "program",
          "type": "promptString",
          "description": "Program name"
        }
      ]
    }
    
    

    Reference link: link