diff --git a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts index fe8032b4490a1..62b66ab4749e3 100644 --- a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts +++ b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts @@ -1585,8 +1585,13 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer let resolverData: Map | undefined; - async function quickResolve(that: AbstractTaskService, identifier: string | TaskIdentifier) { + async function quickResolve(that: AbstractTaskService, uri: URI | string, identifier: string | TaskIdentifier) { const foundTasks = await that._findWorkspaceTasks((task: Task | ConfiguringTask): boolean => { + const taskUri = ((ConfiguringTask.is(task) || CustomTask.is(task)) ? task._source.config.workspaceFolder?.uri : undefined); + const originalUri = (typeof uri === 'string' ? uri : uri.toString()); + if (taskUri?.toString() !== originalUri) { + return false; + } if (Types.isString(identifier)) { return ((task._label === identifier) || (task.configurationProperties.identifier === identifier)); } else { @@ -1649,7 +1654,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return undefined; } if ((resolverData === undefined) && (grouped === undefined)) { - return (await quickResolve(this, identifier)) ?? fullResolve(this, uri, identifier); + return (await quickResolve(this, uri, identifier)) ?? fullResolve(this, uri, identifier); } else { return fullResolve(this, uri, identifier); }