Questions tagged [vscode-tasks]

Visual Studio Code Tasks can be used to run scripts or begin processes in order to leverage other tools to perform tasks from within Visual Studio Code.

Lots of tools exist to automate tasks like linting, building, packaging, testing, or deploying software systems. Examples include the TypeScript Compiler, linters like ESLint and TSLint as well as build systems like Make, Ant, Gulp, Jake, Rake, and MSBuild.

These tools are mostly run from the command line and automate jobs inside and outside the inner software development loop (edit, compile, test, and debug). Given their importance in the development life cycle, it is helpful to be able to run tools and analyze their results from within VS Code. Tasks in VS Code can be configured to run scripts and start processes so that many of these existing tools can be used from within VS Code without having to enter a command line or write new code. Workspace or folder specific tasks are configured from the tasks.json file in the .vscode folder for a workspace.

Extensions can also contribute tasks using a Task Provider, and these contributed tasks can add workspace-specific configurations defined in the tasks.json file.

Website:

https://code.visualstudio.com/docs/editor/tasks

377 questions
242
votes
14 answers

How do I set up Visual Studio Code to compile C++ code?

Microsoft's Visual Studio Code editor is quite nice, but it has no default support for building C++ projects. How do I configure it to do this?
user3703887
83
votes
13 answers

Define multiple tasks in VSCode

I have seen that it is possible to define a task in the VSCode. But I am not sure how to define multiple tasks in the tasks.json file.
Franz Gsell
  • 1,141
  • 1
  • 8
  • 15
45
votes
3 answers

Is it possible to pass arguments to a task in Visual Studio Code

Here's an example of my tasks.json: { "version": "0.1.0", "tasks": [ { "taskName": "test", "suppressTaskName": true, "command": "python", "args": [ "tests/brewer_tests.py" ], "isTestCommand": true …
Luke Sweeney
  • 686
  • 1
  • 5
  • 16
40
votes
8 answers

How do I automatically clear VS Code terminal when starting a build?

I press Ctrl+Shift+B to start a build in Visual Studio Code (it's configured to just run GNU Make), and the build tool output is written to the Terminal window. However, it's appended to the output from the previous build, which is confusing. How do…
Roger Lipscombe
  • 81,986
  • 49
  • 214
  • 348
40
votes
2 answers

How to make vscode not wait for finishing a preLaunchTask?

I have a debug setup in Visual Studio code where I run an external binary which can execute my JS files (using duktape). The debug adapter currently only supports attach requests (not launch) so I have to run the binary before I can debug the JS…
Mike Lischke
  • 36,881
  • 12
  • 88
  • 141
37
votes
9 answers

vscode import error for python module

I am trying to do an import in python from one directory level up. import sys sys.path.append('..') from cn_modules import exception I get an Error from VSCode when I try to do Run Build Task as: ImportError: No module named cn_modules The same…
34
votes
6 answers

Multiple commands/tasks with Visual Studio Code

I have a local folder that I use as a scratch pad for multiple little sample and toy pieces of code. I store a host of python, C++, shell scripts etc. in this directory. I'm using Visual Studio Code (on OS X) and am looking into its tasks to…
Niall
  • 28,102
  • 9
  • 90
  • 124
31
votes
10 answers

code . is not recognized as an internal or external command

I want to open a directory using cmd in visual studio code but its giving me an error in cmd. So, what setting is required for that? I have performed below command D:\RND>code .
baj9032
  • 1,912
  • 1
  • 15
  • 35
30
votes
4 answers

How to get rid of "Terminal will be reused by tasks, press any key to close it." behaviour?

Upon executing a task (cargo build in this case), the following appears in the VSCode terminal: > Executing task: cargo build < (output of the task here) Terminal will be reused by tasks, press any key to close it. Annoyingly, this takes me out…
A.B.
  • 12,107
  • 2
  • 50
  • 56
29
votes
2 answers

how to completely remove vs-code setting?

After I uninstalled vs-code the popup message appeared: Your extensions and settings will not be removed. Now I want to remove all of the vs-code settings and install it as a new user. How can I do this?
Sagor Islam
  • 291
  • 1
  • 4
  • 9
28
votes
4 answers

How to run multiple tasks in VS Code on build?

Using tasks.json version 2.0.0, I have not been able to make it so that, when I build my application, multiple tasks are run at the same time. I'm using gulp for my SCSS compilation, and running my Compile/minify cms.scss task on its own works fine,…
Jacob Stamm
  • 1,064
  • 1
  • 19
  • 47
22
votes
2 answers

How to chain tasks in Visual Studio Code using only tasks.json?

I have been ploughing through the documentation of Visual Studio Code to figure out how to add multiple consecutive tasks to the tasks.json file. The tasks array only allows for creating different arguments to the same command. In this example the…
Kokodoko
  • 19,176
  • 21
  • 88
  • 153
21
votes
1 answer

Visual Studio Code: running preLaunchTask with multiple tasks

I am trying to figure out how to run multiple tasks at once in the prelaunchtask of the launch.json file. My code in the tasks.json is as follows: "version": "2.0.0", "tasks": [ { "label": "CleanUp_Client", "type": "shell", …
Revx0r
  • 893
  • 2
  • 8
  • 16
20
votes
1 answer

A keybindings.json per workspace in Visual Studio Code

Is it possible to have a keybindings.json as part of the workspace settings instead of the user settings? Since I have specific tasks associated to my workspace, I would also like to be able to assign workspace-specific shortcuts. Because I would…
Aris Koning
  • 605
  • 4
  • 17
20
votes
7 answers

VSCode: How to run a command after each terminal open?

On Windows I have to run the command start-ssh-agent.cmd on each new terminal session I open. My development environment is VSCode, and I open a dozen new terminals each day. After each terminal open, I have to manually run this command. Is there is…
1
2 3
24 25