Executing task: cargo build Danin添加the comments : After -6ren">
gpt4 book ai didi

visual-studio-code - 如何摆脱 "Terminal will be reused by tasks, press any key to close it."行为?

转载 作者:行者123 更新时间:2023-12-02 00:45:39 37 4
gpt4 key购买 nike

执行任务(在本例中为 cargo 构建)后,VSCode 终端中将显示以下内容:

> Executing task: cargo build <

(output of the task here)

Terminal will be reused by tasks, press any key to close it.

令人烦恼的是,这让我离开了普通终端,然后我必须获得终端窗口的焦点并按某个键才能返回。当我这样做时,cargo build 的输出就会消失。

如何阻止这种行为?

如何去掉第一行和最后一行文本?

最佳答案

检查 VSCode 1.57(2021 年 5 月,OP 2.5 年后)的新功能是否有帮助:

Automatically close task terminals

The task presentation property has a new close property.
Setting close to true will cause the terminal to close when the task exits.

{
"type": "shell",
"command": "node build/lib/preLaunch.js",
"label": "Ensure Prelaunch Dependencies",
"presentation": {
"reveal": "silent",
"revealProblems": "onProblem",
"close": true
}
}

[编辑:18-08-2018] 使用关闭选项时,将其切换到问题选项卡会更好,因为这样可以确保任务终端关闭,但问题会正确突出显示。这是来自 VSCode 1.59.0。

<小时/>

Danin添加the comments :

After fiddling around, I found an easy way to do it in-app;
Terminal > Configure Tasks > (select your desired task) > add "presentation": { .. } block to level containing matching "task:" entry.

达宁还提到:

I also omitted the "reveal" entry because I prefer to see the terminal briefly -- it just interferes with workflows to have it stick around.

关于visual-studio-code - 如何摆脱 "Terminal will be reused by tasks, press any key to close it."行为?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47946868/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com