为什么 VS 代码中的这个问题匹配器不起作用?
Why doesn't this problemMatcher in VS code work?
为什么我的 problemMatcher 不起作用?我很确定正则表达式,但它没有报告任何问题,即使标准输出上有一些问题...
// the matcher
"problemMatcher": {
"owner": "typescript",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^TypeScript (warning|error): (.*)\((\d+),(\d+)\): (.*)$",
"severity": 1,
"file": 2,
"line": 3,
"column": 4,
"message": 5
}
}
//the browserify/tsify pipeline
browserify().add('main.ts')
.plugin(tsify, { noImplicitAny: false, removeComments:true })
.transform("babelify",{ extensions: ['.ts'], presets: ["es2015"]})
.bundle()
.on('error', function (error) { console.log(error.toString()); })
.pipe(source('bundle.js'))
.pipe(gulp.dest('www/js/dist/'));
//gulp sample output
[00:39:00] Starting 'ts-compile'...
TypeScript error: main.ts(118,30): Error TS2339: Property 'object' does not exist on type 'boolean'.
TypeScript error: main.ts(137,24): Error TS2339: Property 'object' does not exist on type 'boolean'.
TypeScript error: main.ts(507,44): Error TS2304: Cannot find name 'loading'.
[00:39:03] Finished 'ts-compile' after 2.98 s
我通过将 tasks.json
放入 .vscode
文件夹解决了这个问题。我最初以为 tasks.json
会像 tsconfig.json
(project-root) 这样找到,但结果是错误的。
为什么我的 problemMatcher 不起作用?我很确定正则表达式,但它没有报告任何问题,即使标准输出上有一些问题...
// the matcher
"problemMatcher": {
"owner": "typescript",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^TypeScript (warning|error): (.*)\((\d+),(\d+)\): (.*)$",
"severity": 1,
"file": 2,
"line": 3,
"column": 4,
"message": 5
}
}
//the browserify/tsify pipeline
browserify().add('main.ts')
.plugin(tsify, { noImplicitAny: false, removeComments:true })
.transform("babelify",{ extensions: ['.ts'], presets: ["es2015"]})
.bundle()
.on('error', function (error) { console.log(error.toString()); })
.pipe(source('bundle.js'))
.pipe(gulp.dest('www/js/dist/'));
//gulp sample output
[00:39:00] Starting 'ts-compile'...
TypeScript error: main.ts(118,30): Error TS2339: Property 'object' does not exist on type 'boolean'.
TypeScript error: main.ts(137,24): Error TS2339: Property 'object' does not exist on type 'boolean'.
TypeScript error: main.ts(507,44): Error TS2304: Cannot find name 'loading'.
[00:39:03] Finished 'ts-compile' after 2.98 s
我通过将 tasks.json
放入 .vscode
文件夹解决了这个问题。我最初以为 tasks.json
会像 tsconfig.json
(project-root) 这样找到,但结果是错误的。