Search code examples
pythonvisual-studio-codeterminalvisual-glitchvscode-code-runner

VS Code clear previous output before each run


Extensions installed: Python, Code Runner

The problem is I was trying to enable the "clear previous output before each run setting"

enter image description here

But when I try running a simple code the output (in terminal) becomes glitchy.

The code I am running is:

print('hello')
a=input()
print(a)

Here is the first time I run the code in completely Blank terminal

enter image description here

The first attempt is pretty normal.

Here is the what happens when I run the code again

enter image description here

There is a lot of blank space in the terminal which becomes worse the third time I run the code

This blank space worsens till the 5th attempt and here is what happens on the sixth attempt.

enter image description here

Basically the blank space vanishes and all the previous attempts can be seen in the terminal. But that means the initial setting I intended did not apply and terminal does not get cleared before each run.

Can someone tell how to automatically clear terminal before each run.


Solution

  • "code-runner.clearPreviousOutput": true works well in OUTPUT panel, but does not work in the terminal.

    Someone else has submitted a feature request for it. You can refer to this page and upvote it.