Added code-runner.stopWait command
I find it annoying having to close windows produced by Python's matplotlib.pyplot before running the code again.
So I created this keyboard shortcut:
{
"key": "f5",
"command": "runCommands",
"args": {
"commands": [
"code-runner.stop",
"code-runner.run",
]
},
},
But the run commands was being executed too soon - before previous process fully closed - so the new process could not be registered correctly. The result was that new processes (matplotlib windows) would spawn every time I pressed F5.
So I created stopWait command that waits for the process to emit "close" event after it receives the kill signal.
It is a drop-in replacement for the stop command in the shortcut:
{
"key": "f5",
"command": "runCommands",
"args": {
"commands": [
"code-runner.stopWait",
"code-runner.run",
]
},
},
I'm using Python as an example here but this should work for any programming language that waits for anything when run (i.e. user input, network request).