2015-12-02 114 views
5

爲什麼我的problemMatcher不工作?我敢肯定,對正則表達式,但它並沒有報告任何問題,甚至有一些在stdout ...VS代碼中的這個問題爲什麼不起作用?

// 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 
+0

所有正則表達式庫的細節看起來不一樣。如果正則表達式出錯,我會懷疑交替運算符'|'具有比預期更高的優先級。嘗試'((警告)|(錯誤))'看看是否改變任何東西。 – eh9

+0

@santa正則表達式確實有效。我能夠使用問題匹配器爲VSCode中的示例輸出獲取hree錯誤。你的tasks.json文件是怎樣的? – Wosi

+0

已經找到了我的問題@Wosi我不得不把tasks.json放到.vscode文件夾中(其中包含一個默認值,這讓我覺得我的第一個地方被使用了) – santa

回答

3

我通過把tasks.json.vscode文件夾中解決了這個問題。我最初認爲tasks.json會被找到像tsconfig.json(project-root),但事實證明這是錯誤的。

+1

感謝您的語法和文章@nhahtdh – santa

相關問題