Vscode-code-runner: [Request] Add configuration option to re-run tasks without explicitly stopping them first

Created on 26 Jan 2017  ·  10Comments  ·  Source: formulahendry/vscode-code-runner

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! #

feature request

Most helpful comment

There is a workaround:

  1. Install multi-command extension.
  2. Add this to your settings.json and keybindings.json respectively:
"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.

All 10 comments

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:

  1. Install multi-command extension.
  2. Add this to your settings.json and keybindings.json respectively:
"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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

w3adventures picture w3adventures  ·  3Comments

0x7FFFFFFFFFFFFFFF picture 0x7FFFFFFFFFFFFFFF  ·  3Comments

Kelo007 picture Kelo007  ·  3Comments

eegod picture eegod  ·  5Comments

mjaniec2013 picture mjaniec2013  ·  5Comments