diff --git a/extensions/npm/src/main.ts b/extensions/npm/src/main.ts index 82d266687f8..a52b9de7cb3 100644 --- a/extensions/npm/src/main.ts +++ b/extensions/npm/src/main.ts @@ -123,7 +123,7 @@ async function getNpmScriptsAsTasks(): Promise { result.push(task); }); // add some 'well known' npm tasks - result.push(new vscode.Task({ type: 'npm', script: 'install' } as NpmTaskDefinition, `install`, 'npm', new vscode.ShellExecution(`npm install`))); + result.push(new vscode.Task({ type: 'npm', script: 'install' } as NpmTaskDefinition, `install`, 'npm', new vscode.ShellExecution(`npm install`), [])); return Promise.resolve(result); } catch (e) { return Promise.resolve(emptyTasks); diff --git a/src/vs/workbench/api/node/extHostTask.ts b/src/vs/workbench/api/node/extHostTask.ts index e6bd17c90d4..36195a1b02a 100644 --- a/src/vs/workbench/api/node/extHostTask.ts +++ b/src/vs/workbench/api/node/extHostTask.ts @@ -352,7 +352,8 @@ namespace Tasks { group: task.group ? (task.group as types.TaskGroup).id : undefined, command: command, isBackground: !!task.isBackground, - problemMatchers: task.problemMatchers.slice() + problemMatchers: task.problemMatchers.slice(), + hasDefinedMatchers: (task as types.Task).hasDefinedMatchers }; return result; } diff --git a/src/vs/workbench/api/node/extHostTypes.ts b/src/vs/workbench/api/node/extHostTypes.ts index 51c7e0b2934..ee87589d753 100644 --- a/src/vs/workbench/api/node/extHostTypes.ts +++ b/src/vs/workbench/api/node/extHostTypes.ts @@ -1158,6 +1158,7 @@ export class Task implements vscode.Task { private _name: string; private _execution: ProcessExecution | ShellExecution; private _problemMatchers: string[]; + private _hasDefinedMatchers: boolean; private _isBackground: boolean; private _source: string; private _group: TaskGroup; @@ -1170,10 +1171,13 @@ export class Task implements vscode.Task { this.execution = execution; if (typeof problemMatchers === 'string') { this._problemMatchers = [problemMatchers]; + this._hasDefinedMatchers = true; } else if (Array.isArray(problemMatchers)) { this._problemMatchers = problemMatchers; + this._hasDefinedMatchers = true; } else { this._problemMatchers = []; + this._hasDefinedMatchers = false; } this._isBackground = false; } @@ -1227,9 +1231,16 @@ export class Task implements vscode.Task { set problemMatchers(value: string[]) { if (!Array.isArray(value)) { - value = []; + this._problemMatchers = []; + this._hasDefinedMatchers = false; + return; } this._problemMatchers = value; + this._hasDefinedMatchers = true; + } + + get hasDefinedMatchers(): boolean { + return this._hasDefinedMatchers; } get isBackground(): boolean { diff --git a/src/vs/workbench/parts/tasks/common/tasks.ts b/src/vs/workbench/parts/tasks/common/tasks.ts index 43b7cd5a77b..04c51da7beb 100644 --- a/src/vs/workbench/parts/tasks/common/tasks.ts +++ b/src/vs/workbench/parts/tasks/common/tasks.ts @@ -340,6 +340,8 @@ export interface ContributedTask extends CommonTask, ConfigurationProperties { defines: TaskIdentifier; + hasDefinedMatchers: boolean; + /** * The command configuration */ diff --git a/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts b/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts index 4c63c3bbcc5..c339df79443 100644 --- a/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts +++ b/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts @@ -856,7 +856,7 @@ class TaskService extends EventEmitter implements ITaskService { return false; } if (task._source.config === void 0 && ContributedTask.is(task)) { - return true; + return !task.hasDefinedMatchers && task.problemMatchers.length === 0; } let configProperties: TaskConfig.ConfigurationProperties = task._source.config.element; return configProperties.problemMatcher === void 0;