Make identifier computed to better support task customization

This commit is contained in:
Dirk Baeumer
2017-05-29 15:38:55 +02:00
parent bf5bb9de5c
commit fdadd0ed5f
7 changed files with 35 additions and 23 deletions

View File

@@ -316,7 +316,7 @@ namespace Tasks {
detail: extension.id
},
name: task.name,
identifier: task.identifier,
identifier: task.identifier ? task.identifier : `${extension.id}.${task.name}`,
group: types.TaskGroup.is(task.group) ? task.group : undefined,
command: command,
isBackground: !!task.isBackground,

View File

@@ -1030,7 +1030,6 @@ export class BaseTask {
throw illegalArgument('name');
}
this._name = name;
this._identifier = name;
this._problemMatchers = problemMatchers || [];
this._isBackground = false;
this._terminal = Object.create(null);
@@ -1041,11 +1040,11 @@ export class BaseTask {
}
set identifier(value: string) {
if (typeof value !== 'string') {
throw illegalArgument('identifier');
if (value === void 0 || value === null) {
this._identifier = undefined;
}
if (value.indexOf(':') !== -1) {
throw illegalArgument('identifier must not contain \':\'');
if (typeof value !== 'string' || value.length === 0) {
throw illegalArgument('identifier must be a string of length > 0');
}
this._identifier = value;
}