Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gulp 在vscode中,由具有isWatching的任务生成的错误在修复后并不总是被清除_Gulp_Visual Studio Code_Tsc_Tslint - Fatal编程技术网

Gulp 在vscode中,由具有isWatching的任务生成的错误在修复后并不总是被清除

Gulp 在vscode中,由具有isWatching的任务生成的错误在修复后并不总是被清除,gulp,visual-studio-code,tsc,tslint,Gulp,Visual Studio Code,Tsc,Tslint,我在vscode(0.9)中使用了一个gulp任务,试图从typescript和tslint中获取错误 gulp任务正在监视我的ts文件的更改,并对更改运行gulp tslint和gulp typescript。 我还在vscode tasks.json和问题匹配器中定义了一个任务来解析结果 错误被正确解析并报告到vscode中。 然而,即使代码已修复并保存,它们有时也会被保留 是否有一些额外的配置提供给vscode问题匹配器,以便正确清除错误,还是vscode错误? 作为一种解决方法,是否有办

我在vscode(0.9)中使用了一个gulp任务,试图从typescript和tslint中获取错误

gulp任务正在监视我的ts文件的更改,并对更改运行gulp tslint和gulp typescript。 我还在vscode tasks.json和问题匹配器中定义了一个任务来解析结果

错误被正确解析并报告到vscode中。 然而,即使代码已修复并保存,它们有时也会被保留

是否有一些额外的配置提供给vscode问题匹配器,以便正确清除错误,还是vscode错误? 作为一种解决方法,是否有办法手动清除所有错误?我发现清除它们的唯一方法是重新启动vscode,这并不好

请注意,如果任务不是监视任务,而是简单的执行,则此方法可以正常工作

My vscode tasks.json

{
    "version": "0.1.0",
    "command": "gulp",
    "isShellCommand": true,
    "tasks": [
        {
            "taskName": "watch",
            // Make this the default build command.
            "isBuildCommand": true,
            // Watching
            "isWatching": true,
            // Show the output window only if unrecognized errors occur.
            "showOutput": "always",
            // Use the standard less compilation problem matcher.
            "problemMatcher": [
                {
                    "owner": "gulp-tslint",
                    "fileLocation": [
                        "relative",
                        "${workspaceRoot}/app"
                    ],
                    "pattern": {
                        "regexp": ".*\\[gulp-tslint\\] (error|warning) (.*)\\[(\\d*), (\\d*)\\]: (.*)",
                        "severity": 1,
                        "file": 2,
                        "line": 3,
                        "column": 4,
                        "message": 5
                    }
                },
                {
                    "owner": "gulp-typescript",
                    "fileLocation": "absolute",
                    "pattern": {
                        "regexp": "\\[gulp-typescript\\] (.*)\\((\\d*),(\\d*)\\): (error|warning) (.*)",
                        "file": 1,
                        "line": 2,
                        "column": 3,
                        "severity": 4,
                        "message": 5
                    }
                }
            ]
        }
    ]
}
我的吞咽任务定义:

const tslint = require('gulp-tslint');
const typescript = require('gulp-typescript');
gulp.task('watch', function () {
    gulp.watch(srcTsFiles, ['tslint', 'compile']);
});


gulp.task('tslint', function () {
    return gulp.src(srcTsFiles)
        .pipe(tslint())
        .pipe(tslint.report('prose', {
            emitError: false,
            summarizeFailureOutput: true
        }));
});


var tsProject = typescript.createProject('tsconfig.json');
gulp.task('compile', function () {
  tsProject.src()
    .pipe(typescript(tsProject, undefined,             typescript.reporter.longReporter()))
    .pipe(gulp.dest('dist'));
});

这是VSCode中的一个bug。不知何故,它不会对打开的文件应用任何更新。如果文件已关闭,则会删除所有过时的错误

因此,解决方法是单击“工作文件”标题中的小“关闭所有文件”图标。


如果您想自己找出问题所在,请查看VSCode资源中的JS文件;在OSX中,它们驻留在应用程序包中。查找
workbench.main.js
。您将在那里找到
tsc watch
问题匹配器,它将设置
applyTo:c.ApplyToKind.closedDocuments
。我试图将其更改为
allDocuments
,但没有任何效果。

这在最新的内部版本(我测试过)中得到了修复,可能会在下周投入生产


在当前版本的VSCode中仍会发生。在正式回购中创建了一个问题。。