1

Currently I have to enter -exec -enable-pretty-printing into vimspector debugger command line (debugging C++ code using vscode-cpptools) to see std::string as a "string" rather than as a STL container. Could you advice me how to modify my .vimspector.json to run the command automatically on vimspector launch? I tried to google it out but without success... My current .vimspector.json looks like this.

{
  "configurations": {
    "Vim - run a test": {
      "adapter": "vscode-cpptools",
      "configuration": {
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceRoot}/main",
        "args": [
            "-enable-pretty-printing"
        ],
        "cwd": "${workspaceRoot}",
        "environment": [
          { "name": "VIMRUNTIME", "value": "${workspaceRoot}" }
        ],
        "externalConsole": true,
        "stopAtEntry": true,
        "MIMode": "gdb",
        "logging": {
          "engineLogging": false
        }
      }
    }
  }
}

Thx,

Michal

PS: The mentioning -enable-pretty-printing as argument in .json file does not work.

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
Macky
  • 125
  • 9
  • Use the plugin's issue tracker. – romainl Dec 02 '21 at 18:50
  • I can debug the code. It only annoys me having to manually enter ```-exec -enable-pretty-printing``` into the debugger console every time I start debugging. – Macky Dec 02 '21 at 20:40

1 Answers1

2

OK, I have installed vscode and had a look at its configuration files. It seems that the following .vimspector.json file does what I want.

{
  "configurations": {
    "FinMat": {
      "adapter": "vscode-cpptools",
      "configuration": {
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceRoot}/main",
        "args": [],
        "cwd": "${workspaceRoot}",
        "environment": [
          { "name": "VIMRUNTIME", "value": "${workspaceRoot}" }
        ],
        "externalConsole": true,
        "stopAtEntry": true,
        "MIMode": "gdb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ],
        "logging": {
          "engineLogging": false
        }
      }
    }
  }
}
Macky
  • 125
  • 9