简体   繁体   English

如何以编程方式清除 VSCode 中的终端?

[英]How do I clear the terminal in VSCode programmatically?

I would like to clear the terminal each time I run in java automatically.我想每次在java中自动运行时清除终端。 Any idea how I could accomplish this?知道我怎么能做到这一点吗?

I'm sorry to tell you there's no such setting that can clear the terminal automatically, but we have some workarounds except running clear commands in terminal:很遗憾地告诉您,没有这样的设置可以自动清除终端,但是除了在终端中运行清除命令之外,我们还有一些解决方法:

  1. Add "console": "externalTerminal", in launch.json, then every time you run the java project, there will be an new terminal displayed without previous information;在launch.json中添加"console": "externalTerminal",那么每次运行java项目时,都会显示一个没有之前信息的新终端; 在此处输入图片说明

  2. Install Code Runner and add the following code in Settings.json:安装Code Runner并在 Settings.json 中添加以下代码:

     "code-runner.clearPreviousOutput": true, "code-runner.showExecutionMessage": false,

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM