6

Why doesnt my problemMatcher work? I'm pretty sure about the regex, but it doesn't report any problems, even there are some on stdout...

// 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
Simson
  • 3,373
  • 2
  • 24
  • 38
santa
  • 983
  • 9
  • 30
  • All regex libraries seem to differ in their details. If the regex is at fault, I'd suspect that the alternation operator `|` has higher precedence than expected. Try `((warning)|(error))` and see if that changes anything. – eh9 Dec 09 '15 at 11:06
  • @santa The regex works indeed. I'm able to get hree errors for the sample output in VSCode using your problem matcher. How does your tasks.json file look like? – Wosi Dec 09 '15 at 16:21
  • already found my problem @Wosi i had to put the tasks.json into the .vscode folder (which contained a default which made me think that mine was used in the first place) – santa Dec 09 '15 at 17:37

1 Answers1

5

I resolved the problem by putting tasks.json into .vscode folder. I initially thought tasks.json would be found like tsconfig.json (project-root), but it turned out to be wrong.

nhahtdh
  • 55,989
  • 15
  • 126
  • 162
santa
  • 983
  • 9
  • 30