gpt4 book ai didi

visual-studio-code - 开始构建时如何自动清除VS Code终端?

转载 作者:行者123 更新时间:2023-12-03 11:39:34 25 4
gpt4 key购买 nike

我按Ctrl + Shift + B在中开始构建Visual Studio代码(已配置为仅运行GNU Make),并将构建工具输出写入“终端”窗口。

但是,它被附加到先前构建的输出中,这很令人困惑。

在开始新版本之前,如何配置VS Code以清除终端窗口?

最佳答案

2018年11月更新

this commit(以及随后的一些后续操作)开始,您现在可以在任务中添加clear演示文稿选项,以使其在运行每个任务之前清除终端。

工作示例(在新的clone + build上):

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "[gcc] Build",
"type": "shell",
"command": "g++",
"args": [
"source.h",
"-Wall",
"-o",
"a.out"
],
"presentation": {
"clear": true // <-- this line
}
}
]
}

(注意:链接的commit diff的键名为 clearBeforeExecuting,但显然已更改为 clear)。

在此之前,我在路径上仅创建了一个 clear_g++脚本:
#!/bin/bash
clear
exec g++ $*

并将我的 commandg++更改为 clear_g++

由于我喜欢 this approach的想法,但最终没有解决。

关于visual-studio-code - 开始构建时如何自动清除VS Code终端?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61812901/

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