Visual Studio Code Debug Console colors?

后端 未结 8 1473
旧巷少年郎
旧巷少年郎 2020-12-06 04:34

Is there a way to display colors (like in a terminal) in the Debug Console of Visual Studio Code (Version 1.10.2) when debugging node.js code?

相关标签:
8条回答
  • 2020-12-06 05:28

    Really quick and dirty for Java console from a Java noob:

    private static void debugLog(String msg) {
      if (msg.indexOf("Exception") > -1) {
        System.out.println("\u001b[31m" + msg + "\u001b[0m");
      } else {
        System.out.println("\u001b[32m" + msg + "\u001b[0m");
      }
    }
    
    0 讨论(0)
  • 2020-12-06 05:30

    Adding the --colors argument worked for me. (I'm using jest).

    {
      "version": "0.2.0",
      "configurations": [{
        "type": "node",
        "name": "vscode-jest-tests",
        "request": "launch",
        "args": ["--colors"],
        "runtimeArgs": [
          "--inspect-brk",
          "${workspaceRoot}/node_modules/.bin/jest",
          "--runInBand"
        ],
        "cwd": "${workspaceFolder}",
        "console": "integratedTerminal",
        "internalConsoleOptions": "neverOpen",
        "port": 9229
      }]
    }
    
    0 讨论(0)
提交回复
热议问题