VSCode TypeScript problemMatcher `$tsc-watch` not watching

☆樱花仙子☆ 提交于 2020-05-12 02:56:52

问题


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.


回答1:


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
            }
        }
    ]
}


来源:https://stackoverflow.com/questions/49226705/vscode-typescript-problemmatcher-tsc-watch-not-watching

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!