Skip to content

Commit dc4b1c2

Browse files
committed
Rename CustomExecution2 to CustomExecution
Part of microsoft#80375
1 parent 6251b1c commit dc4b1c2

11 files changed

Lines changed: 74 additions & 74 deletions

File tree

extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ suite('workspace-namespace', () => {
1010

1111
suite('Tasks', () => {
1212

13-
test('CustomExecution2 task should start and shutdown successfully', (done) => {
13+
test('CustomExecution task should start and shutdown successfully', (done) => {
1414
interface CustomTestingTaskDefinition extends vscode.TaskDefinition {
1515
/**
1616
* One of the task properties. This can be used to customize the task in the tasks.json
@@ -35,7 +35,7 @@ suite('workspace-namespace', () => {
3535
customProp1: 'testing task one'
3636
};
3737
const writeEmitter = new vscode.EventEmitter<string>();
38-
const execution = new vscode.CustomExecution2((): Thenable<vscode.Pseudoterminal> => {
38+
const execution = new vscode.CustomExecution((): Thenable<vscode.Pseudoterminal> => {
3939
const pty: vscode.Pseudoterminal = {
4040
onDidWrite: writeEmitter.event,
4141
open: () => {

src/vs/vscode.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7298,7 +7298,7 @@ declare module 'vscode' {
72987298
* A number can be used to provide an exit code for the terminal. Exit codes must be
72997299
* positive and a non-zero exit codes signals failure which shows a notification for a
73007300
* regular terminal and allows dependent tasks to proceed when used with the
7301-
* `CustomExecution2` API.
7301+
* `CustomExecution` API.
73027302
*
73037303
* **Example:** Exit the terminal when "y" is pressed, otherwise show a notification.
73047304
* ```typescript

src/vs/vscode.proposed.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ declare module 'vscode' {
942942
/**
943943
* Class used to execute an extension callback as a task.
944944
*/
945-
export class CustomExecution2 {
945+
export class CustomExecution {
946946
/**
947947
* Constructs a CustomExecution task object. The callback will be executed the task is run, at which point the
948948
* extension should return the Pseudoterminal it will "run in". The task should wait to do further execution until
@@ -971,12 +971,12 @@ declare module 'vscode' {
971971
* or '$eslint'. Problem matchers can be contributed by an extension using
972972
* the `problemMatchers` extension point.
973973
*/
974-
constructor(taskDefinition: TaskDefinition, scope: WorkspaceFolder | TaskScope.Global | TaskScope.Workspace, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution2, problemMatchers?: string | string[]);
974+
constructor(taskDefinition: TaskDefinition, scope: WorkspaceFolder | TaskScope.Global | TaskScope.Workspace, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution, problemMatchers?: string | string[]);
975975

976976
/**
977977
* The task's execution engine
978978
*/
979-
execution2?: ProcessExecution | ShellExecution | CustomExecution2;
979+
execution2?: ProcessExecution | ShellExecution | CustomExecution;
980980
}
981981
//#endregion
982982

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
2929
import { ExtHostContext, MainThreadTaskShape, ExtHostTaskShape, MainContext, IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
3030
import {
3131
TaskDefinitionDTO, TaskExecutionDTO, ProcessExecutionOptionsDTO, TaskPresentationOptionsDTO,
32-
ProcessExecutionDTO, ShellExecutionDTO, ShellExecutionOptionsDTO, CustomExecution2DTO, TaskDTO, TaskSourceDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO,
32+
ProcessExecutionDTO, ShellExecutionDTO, ShellExecutionOptionsDTO, CustomExecutionDTO, TaskDTO, TaskSourceDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO,
3333
RunOptionsDTO
3434
} from 'vs/workbench/api/common/shared/tasks';
3535
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
@@ -131,7 +131,7 @@ namespace ProcessExecutionOptionsDTO {
131131
}
132132

133133
namespace ProcessExecutionDTO {
134-
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecution2DTO): value is ProcessExecutionDTO {
134+
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is ProcessExecutionDTO {
135135
const candidate = value as ProcessExecutionDTO;
136136
return candidate && !!candidate.process;
137137
}
@@ -199,7 +199,7 @@ namespace ShellExecutionOptionsDTO {
199199
}
200200

201201
namespace ShellExecutionDTO {
202-
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecution2DTO): value is ShellExecutionDTO {
202+
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is ShellExecutionDTO {
203203
const candidate = value as ShellExecutionDTO;
204204
return candidate && (!!candidate.commandLine || !!candidate.command);
205205
}
@@ -230,21 +230,21 @@ namespace ShellExecutionDTO {
230230
}
231231
}
232232

233-
namespace CustomExecution2DTO {
234-
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecution2DTO): value is CustomExecution2DTO {
235-
const candidate = value as CustomExecution2DTO;
236-
return candidate && candidate.customExecution === 'customExecution2';
233+
namespace CustomExecutionDTO {
234+
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is CustomExecutionDTO {
235+
const candidate = value as CustomExecutionDTO;
236+
return candidate && candidate.customExecution === 'customExecution';
237237
}
238238

239-
export function from(value: CommandConfiguration): CustomExecution2DTO {
239+
export function from(value: CommandConfiguration): CustomExecutionDTO {
240240
return {
241-
customExecution: 'customExecution2'
241+
customExecution: 'customExecution'
242242
};
243243
}
244244

245-
export function to(value: CustomExecution2DTO): CommandConfiguration {
245+
export function to(value: CustomExecutionDTO): CommandConfiguration {
246246
return {
247-
runtime: RuntimeType.CustomExecution2,
247+
runtime: RuntimeType.CustomExecution,
248248
presentation: undefined
249249
};
250250
}
@@ -351,8 +351,8 @@ namespace TaskDTO {
351351
command = ShellExecutionDTO.to(task.execution);
352352
} else if (ProcessExecutionDTO.is(task.execution)) {
353353
command = ProcessExecutionDTO.to(task.execution);
354-
} else if (CustomExecution2DTO.is(task.execution)) {
355-
command = CustomExecution2DTO.to(task.execution);
354+
} else if (CustomExecutionDTO.is(task.execution)) {
355+
command = CustomExecutionDTO.to(task.execution);
356356
}
357357
}
358358

src/vs/workbench/api/common/extHost.api.impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
847847
EndOfLine: extHostTypes.EndOfLine,
848848
EventEmitter: Emitter,
849849
ExtensionKind: extHostTypes.ExtensionKind,
850-
CustomExecution2: extHostTypes.CustomExecution2,
850+
CustomExecution: extHostTypes.CustomExecution,
851851
FileChangeType: extHostTypes.FileChangeType,
852852
FileSystemError: extHostTypes.FileSystemError,
853853
FileType: files.FileType,

src/vs/workbench/api/common/extHostTask.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export namespace ProcessExecutionOptionsDTO {
8888
}
8989

9090
export namespace ProcessExecutionDTO {
91-
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecution2DTO | undefined): value is tasks.ProcessExecutionDTO {
91+
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecutionDTO | undefined): value is tasks.ProcessExecutionDTO {
9292
if (value) {
9393
const candidate = value as tasks.ProcessExecutionDTO;
9494
return candidate && !!candidate.process;
@@ -133,7 +133,7 @@ export namespace ShellExecutionOptionsDTO {
133133
}
134134

135135
export namespace ShellExecutionDTO {
136-
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecution2DTO | undefined): value is tasks.ShellExecutionDTO {
136+
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecutionDTO | undefined): value is tasks.ShellExecutionDTO {
137137
if (value) {
138138
const candidate = value as tasks.ShellExecutionDTO;
139139
return candidate && (!!candidate.commandLine || !!candidate.command);
@@ -170,19 +170,19 @@ export namespace ShellExecutionDTO {
170170
}
171171
}
172172

173-
export namespace CustomExecution2DTO {
174-
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecution2DTO | undefined): value is tasks.CustomExecution2DTO {
173+
export namespace CustomExecutionDTO {
174+
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecutionDTO | undefined): value is tasks.CustomExecutionDTO {
175175
if (value) {
176-
let candidate = value as tasks.CustomExecution2DTO;
177-
return candidate && candidate.customExecution === 'customExecution2';
176+
let candidate = value as tasks.CustomExecutionDTO;
177+
return candidate && candidate.customExecution === 'customExecution';
178178
} else {
179179
return false;
180180
}
181181
}
182182

183-
export function from(value: vscode.CustomExecution2): tasks.CustomExecution2DTO {
183+
export function from(value: vscode.CustomExecution): tasks.CustomExecutionDTO {
184184
return {
185-
customExecution: 'customExecution2'
185+
customExecution: 'customExecution'
186186
};
187187
}
188188
}
@@ -220,13 +220,13 @@ export namespace TaskDTO {
220220
if (value === undefined || value === null) {
221221
return undefined;
222222
}
223-
let execution: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecution2DTO | undefined;
223+
let execution: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecutionDTO | undefined;
224224
if (value.execution instanceof types.ProcessExecution) {
225225
execution = ProcessExecutionDTO.from(value.execution);
226226
} else if (value.execution instanceof types.ShellExecution) {
227227
execution = ShellExecutionDTO.from(value.execution);
228-
} else if ((<vscode.Task2>value).execution2 && (<vscode.Task2>value).execution2 instanceof types.CustomExecution2) {
229-
execution = CustomExecution2DTO.from(<types.CustomExecution2>(<vscode.Task2>value).execution2);
228+
} else if ((<vscode.Task2>value).execution2 && (<vscode.Task2>value).execution2 instanceof types.CustomExecution) {
229+
execution = CustomExecutionDTO.from(<types.CustomExecution>(<vscode.Task2>value).execution2);
230230
}
231231

232232
const definition: tasks.TaskDefinitionDTO | undefined = TaskDefinitionDTO.from(value.definition);
@@ -373,9 +373,9 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
373373
protected _handleCounter: number;
374374
protected _handlers: Map<number, HandlerData>;
375375
protected _taskExecutions: Map<string, TaskExecutionImpl>;
376-
protected _providedCustomExecutions2: Map<string, types.CustomExecution2>;
376+
protected _providedCustomExecutions2: Map<string, types.CustomExecution>;
377377
private _notProvidedCustomExecutions: Set<string>; // Used for custom executions tasks that are created and run through executeTask.
378-
protected _activeCustomExecutions2: Map<string, types.CustomExecution2>;
378+
protected _activeCustomExecutions2: Map<string, types.CustomExecution>;
379379
private _lastStartedTask: string | undefined;
380380
protected readonly _onDidExecuteTask: Emitter<vscode.TaskStartEvent> = new Emitter<vscode.TaskStartEvent>();
381381
protected readonly _onDidTerminateTask: Emitter<vscode.TaskEndEvent> = new Emitter<vscode.TaskEndEvent>();
@@ -399,9 +399,9 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
399399
this._handleCounter = 0;
400400
this._handlers = new Map<number, HandlerData>();
401401
this._taskExecutions = new Map<string, TaskExecutionImpl>();
402-
this._providedCustomExecutions2 = new Map<string, types.CustomExecution2>();
402+
this._providedCustomExecutions2 = new Map<string, types.CustomExecution>();
403403
this._notProvidedCustomExecutions = new Set<string>();
404-
this._activeCustomExecutions2 = new Map<string, types.CustomExecution2>();
404+
this._activeCustomExecutions2 = new Map<string, types.CustomExecution>();
405405
}
406406

407407
public registerTaskProvider(extension: IExtensionDescription, type: string, provider: vscode.TaskProvider): vscode.Disposable {
@@ -454,15 +454,15 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
454454
}
455455

456456
public async $onDidStartTask(execution: tasks.TaskExecutionDTO, terminalId: number): Promise<void> {
457-
const execution2: types.CustomExecution2 | undefined = this._providedCustomExecutions2.get(execution.id);
458-
if (execution2) {
457+
const customExecution: types.CustomExecution | undefined = this._providedCustomExecutions2.get(execution.id);
458+
if (customExecution) {
459459
if (this._activeCustomExecutions2.get(execution.id) !== undefined) {
460460
throw new Error('We should not be trying to start the same custom task executions twice.');
461461
}
462462

463463
// Clone the custom execution to keep the original untouched. This is important for multiple runs of the same task.
464-
this._activeCustomExecutions2.set(execution.id, execution2);
465-
this._terminalService.attachPtyToTerminal(terminalId, await execution2.callback());
464+
this._activeCustomExecutions2.set(execution.id, customExecution);
465+
this._terminalService.attachPtyToTerminal(terminalId, await customExecution.callback());
466466
}
467467
this._lastStartedTask = execution.id;
468468

@@ -573,8 +573,8 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
573573
throw new Error('Unexpected: The resolved task definition must be the same object as the original task definition. The task definition cannot be changed.');
574574
}
575575

576-
if (CustomExecution2DTO.is(resolvedTaskDTO.execution)) {
577-
await this.addCustomExecution2(resolvedTaskDTO, <vscode.Task2>resolvedTask, true);
576+
if (CustomExecutionDTO.is(resolvedTaskDTO.execution)) {
577+
await this.addCustomExecution(resolvedTaskDTO, <vscode.Task2>resolvedTask, true);
578578
}
579579

580580
return await this.resolveTaskInternal(resolvedTaskDTO);
@@ -588,12 +588,12 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
588588
return this._handleCounter++;
589589
}
590590

591-
protected async addCustomExecution2(taskDTO: tasks.TaskDTO, task: vscode.Task2, isProvided: boolean): Promise<void> {
591+
protected async addCustomExecution(taskDTO: tasks.TaskDTO, task: vscode.Task2, isProvided: boolean): Promise<void> {
592592
const taskId = await this._proxy.$createTaskId(taskDTO);
593593
if (!isProvided && !this._providedCustomExecutions2.has(taskId)) {
594594
this._notProvidedCustomExecutions.add(taskId);
595595
}
596-
this._providedCustomExecutions2.set(taskId, <types.CustomExecution2>(<vscode.Task2>task).execution2);
596+
this._providedCustomExecutions2.set(taskId, <types.CustomExecution>(<vscode.Task2>task).execution2);
597597
}
598598

599599
protected async getTaskExecution(execution: tasks.TaskExecutionDTO | string, task?: vscode.Task): Promise<TaskExecutionImpl> {
@@ -619,7 +619,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
619619
}
620620

621621
private customExecutionComplete(execution: tasks.TaskExecutionDTO): void {
622-
const extensionCallback2: vscode.CustomExecution2 | undefined = this._activeCustomExecutions2.get(execution.id);
622+
const extensionCallback2: vscode.CustomExecution | undefined = this._activeCustomExecutions2.get(execution.id);
623623
if (extensionCallback2) {
624624
this._activeCustomExecutions2.delete(execution.id);
625625
}
@@ -674,8 +674,8 @@ export class WorkerExtHostTask extends ExtHostTaskBase {
674674
// If this task is a custom execution, then we need to save it away
675675
// in the provided custom execution map that is cleaned up after the
676676
// task is executed.
677-
if (CustomExecution2DTO.is(dto.execution)) {
678-
await this.addCustomExecution2(dto, <vscode.Task2>task, false);
677+
if (CustomExecutionDTO.is(dto.execution)) {
678+
await this.addCustomExecution(dto, <vscode.Task2>task, false);
679679
} else {
680680
throw new Error('Not implemented');
681681
}
@@ -692,12 +692,12 @@ export class WorkerExtHostTask extends ExtHostTaskBase {
692692
}
693693

694694
const taskDTO: tasks.TaskDTO | undefined = TaskDTO.from(task, handler.extension);
695-
if (taskDTO && CustomExecution2DTO.is(taskDTO.execution)) {
695+
if (taskDTO && CustomExecutionDTO.is(taskDTO.execution)) {
696696
taskDTOs.push(taskDTO);
697697
// The ID is calculated on the main thread task side, so, let's call into it here.
698698
// We need the task id's pre-computed for custom task executions because when OnDidStartTask
699699
// is invoked, we have to be able to map it back to our data.
700-
taskIdPromises.push(this.addCustomExecution2(taskDTO, <vscode.Task2>task, true));
700+
taskIdPromises.push(this.addCustomExecution(taskDTO, <vscode.Task2>task, true));
701701
} else {
702702
console.warn('Only custom execution tasks supported.');
703703
}
@@ -710,7 +710,7 @@ export class WorkerExtHostTask extends ExtHostTaskBase {
710710
}
711711

712712
protected async resolveTaskInternal(resolvedTaskDTO: tasks.TaskDTO): Promise<tasks.TaskDTO | undefined> {
713-
if (CustomExecution2DTO.is(resolvedTaskDTO.execution)) {
713+
if (CustomExecutionDTO.is(resolvedTaskDTO.execution)) {
714714
return resolvedTaskDTO;
715715
} else {
716716
console.warn('Only custom execution tasks supported.');

src/vs/workbench/api/common/extHostTypes.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,7 @@ export enum TaskScope {
17761776
Workspace = 2
17771777
}
17781778

1779-
export class CustomExecution2 implements vscode.CustomExecution2 {
1779+
export class CustomExecution implements vscode.CustomExecution {
17801780
private _callback: () => Thenable<vscode.Pseudoterminal>;
17811781
constructor(callback: () => Thenable<vscode.Pseudoterminal>) {
17821782
this._callback = callback;
@@ -1807,7 +1807,7 @@ export class Task implements vscode.Task2 {
18071807
private _definition: vscode.TaskDefinition;
18081808
private _scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder | undefined;
18091809
private _name: string;
1810-
private _execution: ProcessExecution | ShellExecution | CustomExecution2 | undefined;
1810+
private _execution: ProcessExecution | ShellExecution | CustomExecution | undefined;
18111811
private _problemMatchers: string[];
18121812
private _hasDefinedMatchers: boolean;
18131813
private _isBackground: boolean;
@@ -1816,8 +1816,8 @@ export class Task implements vscode.Task2 {
18161816
private _presentationOptions: vscode.TaskPresentationOptions;
18171817
private _runOptions: vscode.RunOptions;
18181818

1819-
constructor(definition: vscode.TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution2, problemMatchers?: string | string[]);
1820-
constructor(definition: vscode.TaskDefinition, scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution2, problemMatchers?: string | string[]);
1819+
constructor(definition: vscode.TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution, problemMatchers?: string | string[]);
1820+
constructor(definition: vscode.TaskDefinition, scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution, problemMatchers?: string | string[]);
18211821
constructor(definition: vscode.TaskDefinition, arg2: string | (vscode.TaskScope.Global | vscode.TaskScope.Workspace) | vscode.WorkspaceFolder, arg3: any, arg4?: any, arg5?: any, arg6?: any) {
18221822
this._definition = this.definition = definition;
18231823
let problemMatchers: string | string[];
@@ -1882,7 +1882,7 @@ export class Task implements vscode.Task2 {
18821882
type: Task.ShellType,
18831883
id: this._execution.computeId()
18841884
};
1885-
} else if (this._execution instanceof CustomExecution2) {
1885+
} else if (this._execution instanceof CustomExecution) {
18861886
this._definition = {
18871887
type: Task.ExtensionCallbackType,
18881888
id: this._execution.computeId()
@@ -1929,18 +1929,18 @@ export class Task implements vscode.Task2 {
19291929
}
19301930

19311931
get execution(): ProcessExecution | ShellExecution | undefined {
1932-
return (this._execution instanceof CustomExecution2) ? undefined : this._execution;
1932+
return (this._execution instanceof CustomExecution) ? undefined : this._execution;
19331933
}
19341934

19351935
set execution(value: ProcessExecution | ShellExecution | undefined) {
19361936
this.execution2 = value;
19371937
}
19381938

1939-
get execution2(): ProcessExecution | ShellExecution | CustomExecution2 | undefined {
1939+
get execution2(): ProcessExecution | ShellExecution | CustomExecution | undefined {
19401940
return this._execution;
19411941
}
19421942

1943-
set execution2(value: ProcessExecution | ShellExecution | CustomExecution2 | undefined) {
1943+
set execution2(value: ProcessExecution | ShellExecution | CustomExecution | undefined) {
19441944
if (value === null) {
19451945
value = undefined;
19461946
}

0 commit comments

Comments
 (0)