【问题标题】:VS Code task to toggle the status bar on debug executionVS Code 任务在调试执行时切换状态栏
【发布时间】:2020-09-02 08:16:33
【问题描述】:

我更喜欢在 VS 代码中隐藏状态栏,但一个不错的功能是当您的程序准备好调试时它会改变颜色。当作为preLaunchTask 的一部分有一个冗长的构建步骤时,这很好。我想使用tasks.json 取消隐藏和隐藏任务栏。内部命令是

workbench.statusBar.visible true

但我不确定如何通过 vscode 在任务中执行此操作

{
        "label": "debug with statusbar",
        "type": "process", // ?
        "group": "build",
        "args": [ true ],
        "command": "workbench.statusBar.visible",
        "dependsOn":["npm: build"]
},
{
     ...
    

似乎自定义任务既可以通过 shell 执行,也可以作为进程执行。有没有办法通过这些方法之一调用 vscode 并执行内部命令?还是有其他方法可以实现我想要的?

【问题讨论】:

    标签: visual-studio-code vscode-settings vscode-debugger


    【解决方案1】:

    编辑设置文件似乎可以解决问题,因为 VS Code 会实时监视它。

    {
            "label": "debug with statusbar",
            "type": "shell",
            "group": "build",
            "args": [ 
                "-i", 
                "'/\"workbench.statusBar.visible\": false/s/.*/    \"workbench.statusBar.visible\": true/'",
                "/home/myuser/.config/Code/User/settings.json" 
            ],
            "command": "sed",
            "dependsOn":["npm: build"]
    },
    

    那么可以对postDebugTask使用等价任务

    【讨论】:

      猜你喜欢
      • 2020-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-02
      • 2021-05-19
      • 2019-06-26
      • 1970-01-01
      相关资源
      最近更新 更多