I've a simple project in visual studio code with some defined tasks in tasks.json
. Let's say the task are labeled with foo
and bar
.
Inside of visual studio code I can run CTRL+B and select the wanted task.
But - How can I run the task foo
from a command line outside of Visual Studio Code?
To run tasks from VS Code we need a configure the Task Runner. This is done by entering the Command Palette (F1 or ctrl-shift-p), typing task and selecting Tasks: Configure Task Runner.
Executing Commands. To run tasks from VS Code we need a configure the Task Runner. This is done by entering the Command Palette (F1 or ctrl-shift-p), typing task and selecting Tasks: Configure Task Runner. Configure the Task Runner in VS Code. This will create a tasks.json file under the .vscode directory in the current folder.
If its tasks can be run in command line, the command line needs to read tasks.json and parse it, it sounds not a good idea. You can make a same foo.sh instead of foo task in vscode, it can run well and more expansible.
To do this, from an open terminal or command prompt, navigate to your project folder and type code .: Note: Users on macOS must first run a command ( Shell Command: Install 'code' command in PATH) to add VS Code executable to the PATH environment variable. Read the macOS setup guide for help.
There is a python tool that runs the vscode tasks. The last commit was in 2018, but it still might work as it seems that the tasks were last changed in vscode 1.13, released in 2017.
edit:
It works but setup.py:8
needs to be edited to build the wheel on windows, as it tries to run a shell script. My edit was to change the line to log = subprocess.check_output('sh bin/changelog')
as I have sh
installed.
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