Manuel Lehenberger
Manuel Lehenberger

Reputation: 121

VSCODE: How do i enable "tasks: Allow Automatic Tasks In Folder" by default?

I want "tasks: Allow Automatic Tasks In Folder" to be enabled by default when i open a project

this is the tasks.json

{
"version": "2.0.0",
"tasks": [
    {
        "type": "npm",
        "script": "gulp",
        "runOptions": {
            "runOn": "folderOpen"
        }
    }
]

}

it runs on start but only if i call "tasks: Allow Automatic Tasks In Folder" via cmd+shift+p and reopen the project

i need this to be enabled by default. How can i do that ?

Upvotes: 11

Views: 2125

Answers (2)

theking2
theking2

Reputation: 2852

Until VSCode 1.70 (July 2022) it was not possible to Allow Automatic Tasks in Folder by default. It has to be set by the instructions of Manuel Lehenberger.

  1. In VScode type Ctrl+Shift+p
  2. Search and select Tasks: Manage Automatic Tasks in Folder
  3. Click Allow Automatic Tasks in Folder

This has to be done once only. (for every project folder). I make it my routine when creating a new project folder or workspace.

Btw the tasks - section can be incorperated in the .code-workspace file thus removing the need for a .vscode folder and tasks.json file and reducing the clutter.

EDIT: Outdated

Upvotes: 0

VonC
VonC

Reputation: 1328282

With VSCode 1.70 (July 2022) and issue 64618, there will also be a setting associated with the command "Allow Automatic Tasks in Folder".

See PR 154171 and commit 755d39f

There is now a task.allowAutomaticTasks to enable automatic tasks in the folder, with:

  • task.allowAutomaticTasks.on: Always
  • task.allowAutomaticTasks.auto: Prompt for permission for each folder
  • task.allowAutomaticTasks.off: Never

This is available today (July 2022) in the insider release.

Upvotes: 3

Related Questions