VSCode not running task on folder open
Asked Answered
O

1

6

I'm using TypeScript and constantly having to start the tsc-watch task manually. According to to the Blog VSCode v1.30+ can automatically run tasks when a folder is opened but this is not working for me (v1.33.1) - I open my folder and no task is running. enter image description here

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "type": "typescript",
            "tsconfig": "tsconfig.json",
            "isBackground": true,
            "problemMatcher": [
                "$tsc"
            ]
        },
        {
            "type": "typescript",
            "label": "TypeScript Compiler Watcher Thingy...",
            "tsconfig": "tsconfig.json",
            "option": "watch",
            "problemMatcher": [
                "$tsc-watch"
            ],
            "runOptions": {
                "runOn": "folderOpen"
            }
        }
    ]
}

BTW: Also tried this extension and it also did not start the task.

Outburst answered 30/4, 2019 at 14:35 Comment(4)
It would have prompted you for permissions to autorun the task the first time you opened it with that task config. It's possible you clicked "no" by mistake. Try running the command "Allow automatic tasks in folder"Albumenize
I have the same problem with "tsc watch" 2019.11Expressman
Does anyone found working solution ???Cameroun
Ctrl+SHIFT+P and Tasks: Manage Automatic Tasks in Folder and choose Allow Automatic Tasks in folder and restart VS CodeMelanous
C
12

This work in VSCode v. 1.42.1 my tasks.json

    {
     "version": "2.0.0",
     "tasks": [
        {
            "type": "typescript",
            "tsconfig": "tsconfig.json",
            "label": "TypeScript Compiler Watching...",
            "option": "watch",
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared"
            },
            "isBackground": true,
            "runOptions": {"runOn": "folderOpen"},
            "problemMatcher": [
                "$tsc-watch"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
   }

If this still not work on project folder open try Ctrl+shift+P and Tasks: Manage Automatic Tasks in Folder and choose "Allow Automatic Tasks in folder" on main project folder or running folder.

Cameroun answered 24/2, 2020 at 10:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.