Skip to content

Commit

Permalink
only get workspace tasks when getKnownTasks is called if in a trust…
Browse files Browse the repository at this point in the history
…ed workspace, prevent trust dialog from showing for this case (#225087)

fix #224881
  • Loading branch information
meganrogge authored Aug 7, 2024
1 parent 9af3636 commit 4a7a65c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
return Promise.resolve<Task[]>([]);
}

return this._getGroupedTasks(filter, true).then((map) => this.applyFilterToTaskMap(filter, map));
return this._getGroupedTasks(filter, true, true).then((map) => this.applyFilterToTaskMap(filter, map));
}

public taskTypes(): string[] {
Expand Down Expand Up @@ -2023,7 +2023,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
return !definition || !definition.when || this._contextKeyService.contextMatchesRules(definition.when);
}

private async _getGroupedTasks(filter?: ITaskFilter, waitToActivate?: boolean): Promise<TaskMap> {
private async _getGroupedTasks(filter?: ITaskFilter, waitToActivate?: boolean, knownOnlyOrTrusted?: boolean): Promise<TaskMap> {
await this._waitForAllSupportedExecutions;
const type = filter?.type;
const needsRecentTasksMigration = this._needsRecentTasksMigration();
Expand Down Expand Up @@ -2110,7 +2110,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
}

try {
await Promise.all(this._getCustomTaskPromises(Array.from(await this.getWorkspaceTasks()), filter, result, contributedTasks, waitToActivate));
let tasks: [string, IWorkspaceFolderTaskResult][] = [];
// prevent workspace trust dialog from being shown in unexpected cases #224881
if (!knownOnlyOrTrusted || this._workspaceTrustManagementService.isWorkspaceTrusted()) {
tasks = Array.from(await this.getWorkspaceTasks());
}
await Promise.all(this._getCustomTaskPromises(tasks, filter, result, contributedTasks, waitToActivate));
if (needsRecentTasksMigration) {
// At this point we have all the tasks and can migrate the recently used tasks.
await this._migrateRecentTasks(result.all());
Expand Down

0 comments on commit 4a7a65c

Please sign in to comment.