VSCode TypeScript problemMatcher `$tsc-watch` not watching
Asked Answered
N

1

5

I'm trying to avoid having to use watch: true in a tsconfig.json configuration.

Through VSCode's tasks I'm using the base problem matcher $tsc-watch but it's not launching tsc in watch mode when building. I'm adding gulp support and I see there is gulp-watch but I'd like to understand why $tsc-watch isn't working as I believe it should.

Nephoscope answered 12/3, 2018 at 0:51 Comment(3)
Are you using "schema": 2.0?Scalf
@AluanHaddad I am. I just figured out by looking at the VS Code typescript extension sourceNephoscope
just checking because I ran into a weird issue when the schema wasn't explicitly set the other dayScalf
N
6

I figured this out by looking at the typescript extension's taskProvider.js. In order for tsc-watch to function the task needed option: "watch" to be set.

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "typescript",
            "tsconfig": "tsconfig.json",
            "isBackground": true,
            "problemMatcher": ["$tsc-watch"],
            "option": "watch",
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared"
            },
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}
Nephoscope answered 12/3, 2018 at 5:50 Comment(2)
Interesting, is this documented? If not maybe send a PRScalf
docs at code.visualstudio.com/docs/editor/tasksOriginal

© 2022 - 2024 — McMap. All rights reserved.