I didn't find the answer on Internet so I'm asking here. I'm actually dev on Visual Studio Code some language like Python for example. If I'm running the code, it's always opening a new terminal so I can have faster a lot of terminal opened and it's a pain to close them every time. It is possible to run the code in the current terminal opened without write my self "python filename" ?
To run a project in VSCode as a task, all you need to do is create a .vscode/tasks.json file like so. The following task will open in the integrated terminal:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Run shell command",
"type": "shell",
"command": "echo 'Hello world!'",
"group": "test",
"presentation": {
"panel": "shared",
"reveal": "always",
"focus": true
},
}
]
}
Key focus to running in the same terminal is the "panel": "shared" line. This runs the command in the same terminal.
Note: this task is untested as I do not have access to a VSCode instance at the moment.
Here is some more information on VSCode tasks. Here is a Python task tutorial by VSCode. More information on task output behaviour.
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