Skip to content

Commit c82dacd

Browse files
committed
Correct id type, inherit id/color individually from parent
Fixes microsoft#153490
1 parent b18f9e0 commit c82dacd

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/vs/workbench/api/browser/mainThreadTask.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ namespace TaskDTO {
342342
return result;
343343
}
344344

345-
export function to(task: ITaskDTO | undefined, workspace: IWorkspaceContextService, executeOnly: boolean, icon?: { id: string; color?: string }): ContributedTask | undefined {
345+
export function to(task: ITaskDTO | undefined, workspace: IWorkspaceContextService, executeOnly: boolean, icon?: { id?: string; color?: string }): ContributedTask | undefined {
346346
if (!task || (typeof task.name !== 'string')) {
347347
return undefined;
348348
}

src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,12 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
512512
for (const dependency of task.configurationProperties.dependsOn) {
513513
const dependencyTask = await resolver.resolve(dependency.uri, dependency.task!);
514514
if (dependencyTask) {
515-
dependencyTask.configurationProperties.icon = dependencyTask.configurationProperties.icon || task.configurationProperties.icon;
515+
if (dependencyTask.configurationProperties.icon) {
516+
dependencyTask.configurationProperties.icon.id ||= task.configurationProperties.icon?.id;
517+
dependencyTask.configurationProperties.icon.color ||= task.configurationProperties.icon?.color;
518+
} else {
519+
dependencyTask.configurationProperties.icon = task.configurationProperties.icon;
520+
}
516521
const key = dependencyTask.getMapKey();
517522
let promise = this._activeTasks[key] ? this._getDependencyPromise(this._activeTasks[key]) : undefined;
518523
if (!promise) {
@@ -1037,7 +1042,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
10371042
remoteAuthority: this._environmentService.remoteAuthority
10381043
});
10391044
let icon: URI | ThemeIcon | { light: URI; dark: URI } | undefined;
1040-
if (task.configurationProperties.icon) {
1045+
if (task.configurationProperties.icon?.id) {
10411046
icon = ThemeIcon.fromId(task.configurationProperties.icon.id);
10421047
} else {
10431048
const taskGroupKind = task.configurationProperties.group ? GroupKind.to(task.configurationProperties.group) : undefined;

src/vs/workbench/contrib/tasks/common/tasks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ export interface IConfigurationProperties {
548548
/**
549549
* The icon for this task in the terminal tabs list
550550
*/
551-
icon?: { id: string; color?: string };
551+
icon?: { id?: string; color?: string };
552552
}
553553

554554
export enum RunOnOptions {
@@ -912,7 +912,7 @@ export class ContributedTask extends CommonTask {
912912
/**
913913
* The icon for the task
914914
*/
915-
icon: { id: string; color?: string } | undefined;
915+
icon: { id?: string; color?: string } | undefined;
916916

917917
public constructor(id: string, source: IExtensionTaskSource, label: string, type: string | undefined, defines: KeyedTaskIdentifier,
918918
command: ICommandConfiguration, hasDefinedMatchers: boolean, runOptions: IRunOptions,

0 commit comments

Comments
 (0)