This would be a boolean user.setting option that when true (set the false by default) would allow users to re-run their script with the "Run Code" command or hotkey without first being served the "Code is already running!" dialog and having to stop their running code.
So ideally re-running a piece of code while another instance is already running would automatically stop the prior instance and start the new instance without presenting a jarring dialog etc.
This would definitely be useful for fast iterative work on languages like AutoHotKey, where scripts are commonly re-run without first closing them.
p.s. love the extension! #
Thanks @JarvisPrestidge for using this extension. I will plan to implement your request.
Has something like this been added yet? Would be really helpful for AutoHotkey scripts.
As an added request, knowing it's probably a little too specific...
It would be cool when running an AutoHotkey script and Code Runner sees #SingleInstance force that it would run the code without warning.
In AutoHotkey the Directive #SingleInstance force means "_Replace running instance without warning_".
I would love to see this as well.
I would seriously LOVE this as well. I've moved all AHK development to VSCode and this little feature would super useful.
Yeah, I hope this feature too. As I'm running C/C++ code in terminal. I often need to re-run the code while current code is running. Every time I click the run-code button when code is still waiting for inputs, the commands are sent directly to the input and I have to manually stroke Ctrl-C to end current process before running edited code.
There is a workaround:
"multiCommand.commands": [
{
"command": "multiCommand.reRun",
"sequence": [
"code-runner.stop",
"code-runner.run"
]
}
]
{ "key": "F1", "command": "multiCommand.reRun", "when": "editorTextFocus" }
Done. However, it will be much better to have built-in option. For a lot of users, like me, using a lot of extensions slows down VS Code. So, I prefer to use as fewer extensions, as possible, and for that reason I'm not completely OK to use additional extension for this single task.
Thanks @john-cj . This is really helpful.
Hope to see this enhancement implemented too.
@john-cj for me sequence code-runner.stop does not work ... just code-runner.run task working
Hope to see this enhancement implemented too.
Me too, I also wonder why something simple wasn't implemented.
Most helpful comment
There is a workaround:
Done. However, it will be much better to have built-in option. For a lot of users, like me, using a lot of extensions slows down VS Code. So, I prefer to use as fewer extensions, as possible, and for that reason I'm not completely OK to use additional extension for this single task.