i have this task that is server for my application:
"tasks": [
{
"label": "f1",
"type": "shell",
"command": "gunicorn",
"args": [
"main:api"
],
"isBackground": true,
},
]
is mapped on key "F1", now, if this task is active, when i press F1, i want to kill it and start again. So i don't have to press CTRL-C each time i write new function.
How i can implement this behaivor? - Thanks
To open the terminal: Use the Ctrl+` keyboard shortcut with the backtick character. Use the View > Terminal menu command. From the Command Palette (Ctrl+Shift+P), use the View: Toggle Terminal command.
That shortcut is Ctrl + Alt + N. There are a few more ways to run code. Pressing F1 and then choosing “Run Code” also works. If you want to type it out after pressing F1, you're free to do that as well.
As suggested by @jahuuar, there's a command for this:
Open the command palette (CMD/CTRL + Shift + P or Menu>View>Command Palette) and type "restart", you'll see "Tasks: Restart Running Task". If that's what you are looking for (it will ask for the task to restart, even if there is only one... Oo), you can then map a keyboard shortcut to that command.
As per Visual Studio Code Version 1.39.0 , You can right click the Output Area and choose
"Stop Code Run"
. Hope this is what you are looking for. Thanks
in the output area you can "Stop Code Run"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With