0

I'm new to python coding.

My spec's are:

MacBook Pro macOs 10.14.6 (Mojave).
Python 3.9.0 loaded october 5, 2020.
Visual Studio Code 1.49.3

I would like in a given file.py, to automatically : Save the modified script and Erase the previous output in the output window, before running the new modified code.

In VSC, I have tried without success:

"save" "autosave", then in "settings.json" to add: "code-runner.saveAllFilesBeforeRun" : true.

According to a contributor's suggestion (Molly Wang) , I have added in settings.json :

"files.autoSave": "afterDelay", "code-runner.clearPreviousOutput": true,

But in VSC output window, neither the autosave nor the automatic erase works, and I don't understand why.enter image description here

  • Does this answer your question? [Visual Studio Code - Save file before build](https://stackoverflow.com/questions/43643629/visual-studio-code-save-file-before-build) – sophros Oct 13 '20 at 16:06

1 Answers1

0

Add this in settings.json:

"files.autoSave": "afterDelay",
"code-runner.clearPreviousOutput": true,

enter image description here

Molly Wang-MSFT
  • 7,943
  • 2
  • 9
  • 22
  • Thanks for answering. I have followed your suggestions : the autosave works perfectly, but there is still no previous output clearing. Any idea ? – Serge CHAMOISEAU Oct 14 '20 at 16:12
  • This setting should work in OUTPUT which only show the latest result. Do you mean clear previous result in TERMINAL? – Molly Wang-MSFT Oct 15 '20 at 01:41
  • My script is actually running in the VSC output window. But despite adding in settings.json the two lines of user settings you suggested me yesterday , I notice today there is neither autosave of modifications I do in my script, nor automatic erasing of the previous code (although these two features work perfectly in Pycharm). This is somewhat disturbing. I apparently can't insert any screenshot in this answer box. Thanks for your suggestions – Serge CHAMOISEAU Oct 15 '20 at 19:14
  • you can post the screenshot in your question – Molly Wang-MSFT Oct 16 '20 at 01:58