Skip to content

Commit

Permalink
plugin: align provideTasks
Browse files Browse the repository at this point in the history
The commit updates the `provideTasks` (ext side) to omit the
cancellation token which is not present in vscode, and instead pass it
when directly calling the method from the task provider adpater.

Signed-off-by: vince-fugnitto <[email protected]>
  • Loading branch information
vince-fugnitto committed Sep 8, 2021
1 parent 907a9c2 commit ed82493
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/plugin-ext/src/common/plugin-api-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@ export const MAIN_RPC_CONTEXT = {
};

export interface TasksExt {
$provideTasks(handle: number, token?: CancellationToken): Promise<TaskDto[] | undefined>;
$provideTasks(handle: number): Promise<TaskDto[] | undefined>;
$resolveTask(handle: number, task: TaskDto, token?: CancellationToken): Promise<TaskDto | undefined>;
$onDidStartTask(execution: TaskExecutionDto, terminalId: number): void;
$onDidEndTask(id: number): void;
Expand Down
5 changes: 3 additions & 2 deletions packages/plugin-ext/src/plugin/tasks/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { TaskProviderAdapter } from './task-provider';
import { Emitter, Event } from '@theia/core/lib/common/event';
import { TerminalServiceExtImpl } from '../terminal-ext';
import { UUID } from '@theia/core/shared/@phosphor/coreutils';
import { CancellationToken } from '@theia/core/lib/common/cancellation';

type ExecutionCallback = (resolvedDefinition: theia.TaskDefinition) => Thenable<theia.Pseudoterminal>;
export class TasksExtImpl implements TasksExt {
Expand Down Expand Up @@ -164,10 +165,10 @@ export class TasksExtImpl implements TasksExt {
throw new Error('Task was not successfully transformed into a task config');
}

$provideTasks(handle: number, token: theia.CancellationToken): Promise<TaskDto[] | undefined> {
$provideTasks(handle: number): Promise<TaskDto[] | undefined> {
const adapter = this.adaptersMap.get(handle);
if (adapter) {
return adapter.provideTasks(token).then(tasks => {
return adapter.provideTasks(CancellationToken.None).then(tasks => {
if (tasks) {
for (const task of tasks) {
if (task.taskType === 'customExecution') {
Expand Down

0 comments on commit ed82493

Please sign in to comment.