Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/debugtest/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,29 @@ You can specify a task's run behaviors using the `runOptions` property:
* **runOn**: Specifies when a task is run.
* `default` - The task will only be run when executed through the **Run Task** command.
* `folderOpen` - The task will be run when the containing folder is opened. The first time you open a folder that contains a task with `folderOpen`, you will be asked if you want to allow tasks to run automatically in that folder. You can change your decision later using the **Manage Automatic Tasks** command and selecting between **Allow Automatic Tasks** and **Disallow Automatic Tasks**.

### Controlling automatic task execution

The `task.allowAutomaticTasks` setting controls whether tasks with `"runOn": "folderOpen"` are allowed to run automatically when you open a workspace. This setting provides security by preventing unintended task execution.

>**Note:** As of [VS Code 1.109](/updates/v1_109.md#automatic-tasks-disabled-by-default), the default for `task.allowAutomaticTasks` changed from `on` to `off` to improve security.

* **off** (default) - Automatic tasks will not run when opening a workspace. You must explicitly allow them using the **Manage Automatic Tasks** command.
* **on** - Automatic tasks will always run when opening a workspace without prompting.
* **auto** - You will be prompted once per folder to allow or disallow automatic tasks.

To change this setting, add it to your user or workspace settings:

```json
{
"task.allowAutomaticTasks": "off"
}
```

You can also manage automatic tasks on a per-workspace basis using the **Manage Automatic Tasks** command from the Command Palette, which allows you to choose **Allow Automatic Tasks** or **Disallow Automatic Tasks** for the current workspace.

### Additional run options

* **instanceLimit** - The number of instances of the task that are allowed to run simultaneously. The default value is `1`.
* **instancePolicy** - Determines what happens when a task has reached its `instanceLimit`. Can be set to:
* `prompt` - Prompt the user which instance to terminate (default).
Expand Down