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

2

11

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 ?

Past answered 5/6, 2019 at 18:27 Comment(10)
Does the "runOn": "default" option do what you want?Misfit
hey Mark thx for the reply :) unfortunately not .. with "runOn": "default" it wont fire on startup at all .. in this scenario i need to call "npm run gulp" manually in the vscode-terminalPast
You may have to select the command "Tasks: Allow Automatic Tasks in Folder" in the command palette. And then I had to do a couple of restarts or reloads to get it to work the first time and then it seems better. With "runOn": "folderOpen".Misfit
Sorry, I see that you were previously doing the command. I did have to do a couple of full restarts to get it to work. See #56739321Misfit
In VSCode 1.40.0 you have to open the task palette and first select Tasks: Manage Automatic Tasks in Folder then you can select Allow Automatic Tasks in FolderTroopship
@Troopship Your comment is an answer. I'll give you a chance to post it as answer otherwise I will in a couple days.Hoekstra
@c-perkins mine isn't an answer. What the OP is asking for is impossible. I only commented because there was a change in some version of VSCode that added an extra menu item before you can select what the OP described as the current workaround. Hopefully this helps someone who was confused (like me).Troopship
Actually once you set Allow Automatic Tasks in Folder, it works every time you open the folder.Ssm
This is a good question. But might need a rephrase: Where is the setting Allow Automatic Tasks in Folder stored and how can I activate it for all projects?Krebs
@Krebs The setting is now (July 2022) here with VSCode 1.70.Sideward
S
3

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.

Sideward answered 9/7, 2022 at 18:9 Comment(0)
K
0

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

Krebs answered 24/2, 2021 at 11:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.