VSCode TypeScript问题Matcher`$ tsc-watch`未观看 [英] VSCode TypeScript problemMatcher `$tsc-watch` not watching

查看:96
本文介绍了VSCode TypeScript问题Matcher`$ tsc-watch`未观看的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图避免在tsconfig.json配置中使用watch: true.

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

通过VSCode的任务,我正在使用基本问题匹配器$tsc-watch,但在构建时不会在监视模式下启动tsc.我正在添加gulp支持,我看到有gulp-watch,但我想了解为什么$tsc-watch不能按我认为的那样工作.

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.

推荐答案

我是通过查看typescript扩展名的taskProvider.js来解决这个问题的.为了使tsc-watch起作用,需要设置option: "watch"任务.

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

这篇关于VSCode TypeScript问题Matcher`$ tsc-watch`未观看的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆