I've managed to setup VS Code on my win10 with Extension Pack for Java and
Code Runner I also enabled "clear previous output"
each time I right click and "Run Java",
VS code dump the output on the terminal window cumulatively.
the red rectangle indicates the first output and the blue the 2nd.
which means vscode doesn't clear the output before new run, and then I tried another option
which works for the simple pojo project.
However, when I run the spring boot project, the terminal window keeps part of the logging anyway,
how do I make vscode clear all the previous spring boot output automatically as it does for pojo projects?
PS:
I also tried this task config which doesn't work either.
{
"version": "2.0.0",
"tasks": [
{
"type": "java",
"mainClass": "com.example.mongo.MongoApplication",
"targetPath": "${workspaceFolder}/${workspaceFolderBasename}.jar",
"elements": [
"${compileOutput}",
"${dependencies}"
],
"problemMatcher": [],
"label": "java: exportjar:mongo",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"clear": true // <-- this line
}
}
]
}
Best Answer
A possible solution, published recently on Stack Overflow, is to modify
settings.json
so it looks like this:If this doesn't work either (in addition to the other suggestions below the post), then the basic problem is that
"code-runner.clearPreviousOutput": true
works well in the OUTPUT panel, but does not work in the terminal.A feature request was submitted for it at : Add code-runner.clearPrevious for terminal tab #832. You may upvote it, which is basically your last option.