diff --git a/packages/cpp/src/browser/cpp-task-provider.spec.ts b/packages/cpp/src/browser/cpp-task-provider.spec.ts index 299a001e30967..f7f5ea176d897 100644 --- a/packages/cpp/src/browser/cpp-task-provider.spec.ts +++ b/packages/cpp/src/browser/cpp-task-provider.spec.ts @@ -99,7 +99,7 @@ describe('CppTaskProvider', function (): void { const resolvedTask = await taskProvider.resolveTask(tasks[0]); expect(resolvedTask.type === 'shell'); - expect((resolvedTask).cwd).to.be.equal('/tmp/build2'); + expect((resolvedTask).options!.cwd).to.be.equal('/tmp/build2'); expect((resolvedTask).command).to.be.equal('very'); expect((resolvedTask).args).to.deep.equal(['complex', 'command']); }); diff --git a/packages/cpp/src/browser/cpp-task-provider.ts b/packages/cpp/src/browser/cpp-task-provider.ts index 94fa82a0e78d9..094bea434b198 100644 --- a/packages/cpp/src/browser/cpp-task-provider.ts +++ b/packages/cpp/src/browser/cpp-task-provider.ts @@ -124,7 +124,9 @@ export class CppTaskProvider implements TaskContribution, TaskProvider, TaskReso type: 'shell', command, args, - cwd: task.config.directory, + options: { + cwd: task.config.directory, + } }; return resolver.resolveTask(resolvedTask); } diff --git a/packages/task/src/browser/quick-open-task.ts b/packages/task/src/browser/quick-open-task.ts index a8fccd3fdddc6..58eadbd558438 100644 --- a/packages/task/src/browser/quick-open-task.ts +++ b/packages/task/src/browser/quick-open-task.ts @@ -283,7 +283,7 @@ export class TaskRunQuickOpenItem extends QuickOpenGroupItem { } if (this.taskDefinitionRegistry && !!this.taskDefinitionRegistry.getDefinition(this.task)) { - this.taskService.run(this.task.source, this.task.label); + this.taskService.run(this.task.source || this.task._source, this.task.label); } else { this.taskService.run(this.task._source, this.task.label); } diff --git a/packages/task/src/browser/task-name-resolver.ts b/packages/task/src/browser/task-name-resolver.ts index 849ca1da2eaf1..43cf251a1e283 100644 --- a/packages/task/src/browser/task-name-resolver.ts +++ b/packages/task/src/browser/task-name-resolver.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { inject, injectable } from 'inversify'; -import { TaskConfiguration } from '../common'; +import { TaskConfiguration, ContributedTaskConfiguration } from '../common'; import { TaskDefinitionRegistry } from './task-definition-registry'; @injectable() @@ -28,11 +28,15 @@ export class TaskNameResolver { * It is aligned with VS Code. */ resolve(task: TaskConfiguration): string { - if (this.taskDefinitionRegistry.getDefinition(task)) { - return `${task.source}: ${task.label}`; + if (this.isDetectedTask(task)) { + return `${task.source || task._source}: ${task.label}`; } // it is a hack, when task is customized but extension is absent return task.label || `${task.type}: ${task.task}`; } + + private isDetectedTask(task: TaskConfiguration): task is ContributedTaskConfiguration { + return !!this.taskDefinitionRegistry.getDefinition(task); + } }