首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在vscode中,使用isWatching的任务生成的错误在修复后并不总是会被清除

在vscode中,使用isWatching的任务生成的错误在修复后并不总是会被清除
EN

Stack Overflow用户
提问于 2015-11-06 17:05:35
回答 2查看 1.3K关注 0票数 11

我在vscode (0.9)中使用gulp任务来尝试从typescript和tslint中获取错误。

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

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

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

请注意,如果任务不是监视任务,而是一个简单的执行,则可以很好地工作。

我的vscode tasks.json

代码语言:javascript
复制
{
    "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
                    }
                }
            ]
        }
    ]
}

我的吞咽任务定义:

代码语言:javascript
复制
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'));
});
EN

回答 2

Stack Overflow用户

发布于 2015-11-17 08:31:36

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

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

如果您希望自己找出问题所在,请查看VSCode资源中的JS文件;在OSX中,这些文件位于应用程序包中。查找workbench.main.js。您将在其中找到tsc-watch问题匹配器,并且它将设置applyTo:c.ApplyToKind.closedDocuments。我试图将其更改为allDocuments,但无济于事。

票数 3
EN

Stack Overflow用户

发布于 2015-12-15 19:32:57

这个问题已经在最新的内部版本(我测试过了)中修复了,可能会在下周投入生产。

https://github.com/Microsoft/vscode/issues/909

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33563049

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档