Why Visual Studio Code's Debug Console output is escaped and how to fix it?

2

Currently when I launch a program with LLDB debugger in Visual Studio Code, for some reason I'm getting escaped stdout output in VSCode's Debug Console. For example, my program outputs this:

Playable cards: s9 s0 s8 s7
Playing: s9
  Playable cards: s0 s8 s7
  Playing: s0
    Playable cards: s8 s7

But in VSCode's Debug Console I get this:

@"Playable cards: s9 s0 s8 s7 \r\n"
@"Playing: s9\r\n"
@"  Playable cards: s0 s8 s7 \r\n"
@"  Playing: s0\r\n"
@"    Playable cards: s8 s7 \r\n"

Why is it formatted like this and is it possible to fix it? This is on OSX, with latest VSCode.

My .vscode/launch.json looks like this:

{
    // 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": [
        {
            "name": "solitaire",
            "type": "cppdbg",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/build/solitaire",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "internalConsoleOptions": "openOnSessionStart",
            "MIMode": "lldb"
        }
    ]
}

Smilediver

Posted 2018-09-28T10:30:03.570

Reputation: 121

Answers

0

You can workaround this by adding "externalConsole": true to launch.json, which will send the output to a separate terminal window.

Chen Lim

Posted 2018-09-28T10:30:03.570

Reputation: 101