如何在不关闭的情况下重用 VS Code 任务窗口

Dau*_*eDK 5 visual-studio-code vscode-tasks

我的目标是在 VS Code 中重用任务窗口。但是,当我输入 ctrl + c 时,任务停止,然后写道:“终端将被任务重用,按任意键将其关闭。 ”。

我不想关窗。这令人沮丧,因为它迫使我打开一个新窗口并导航到正确的目录。

我记录了问题的 gif(它是右侧的窗口):

在此处输入图片说明

我的任务配置如下所示:

{
    "label": "some label",
    "type": "npm",
    "script": "build",
    "path": "some-path/",
    "problemMatcher": [],
    "runOptions": { "runOn": "folderOpen" },
    "group": "build",
    "presentation": {
        "echo": true,
        "reveal": "silent",
        "focus": false,
        "panel": "shared",
        "showReuseMessage": false,
        "clear": false,
        "group": "build"
    }
}
Run Code Online (Sandbox Code Playgroud)

我尝试了各种presentation属性的组合,但没有任何帮助。

关于 VS 代码的相关功能请求在这里

njh*_*jha 0

听起来您想在任务完成后在正确的文件夹中启动 shell。我不确定这是否是最好的方法,但我对复合任务做了类似的事情。

{
    "label": "some label",
    "type": "npm",
    "script": "build",
    "path": "some-path/",
    "problemMatcher": [],
    "runOptions": { "runOn": "folderOpen" },
    "group": "build",
    "presentation": {
        "echo": true,
        "reveal": "silent",
        "focus": false,
        "panel": "shared",
        "showReuseMessage": false,
        "clear": false,
        "group": "build"
    }
},
{
    "label": "shell",
    "type": "shell",
    "command": "cd app; bash",
    "group": {
        "kind": "build",
        "isDefault": true
    }
},
{
    "label": "Task and Shell",
    "group": "build",
    "dependsOn": ["some label", "shell"],
    "dependsOrder": "sequence",
}
Run Code Online (Sandbox Code Playgroud)

此配置在任务之后的右侧文件夹中运行 bash(在同一窗口中)。bash如有必要,请替换为您使用的任何外壳。