首页 > 解决方案 > 使用 Visual Studio Code 'Makefile' 扩展时如何启用漂亮打印

问题描述

我正在将 VS Code 用于 Linux 中的 C++ 项目。它有一个 Makefile,所以我在 VS Code 中启用了 Makefile 扩展( https://devblogs.microsoft.com/cppblog/now-announcing-makefile-support-in-visual-studio-code/][1] 。

我可以成功构建、调试和执行。但是,当我使用 Makefile 扩展进行调试时,我无法弄清楚如何自动启用漂亮的打印。我的“launch.json”文件确实有

  "setupCommands": [
    {
      "description": "Enable pretty-printing for gdb",
      "text": "-enable-pretty-printing",
      "ignoreFailures": true
    }
  ],

但是,Makefile 扩展名似乎忽略了这些设置。相反,它似乎有自己的 settings.json 文件,其中一部分如下,但它不接受setupCommands上述内容:

  "makefile.launchConfigurations": [
    {
      "cwd": "/path/to/bin",
      "binaryPath": "/path/to/executable",
      "binaryArgs": []
    }
  ],

标签: visual-studio-codemakefilepretty-print

解决方案


推荐阅读