Skip to content

Commit a98faa4

Browse files
committed
Remove CustomExecution
Fixes microsoft#78540
1 parent 8785c87 commit a98faa4

10 files changed

Lines changed: 34 additions & 293 deletions

File tree

src/vs/vscode.proposed.d.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,24 +1029,6 @@ declare module 'vscode' {
10291029
//#endregion
10301030

10311031
//#region CustomExecution
1032-
/**
1033-
* Class used to execute an extension callback as a task.
1034-
*/
1035-
export class CustomExecution {
1036-
/**
1037-
* @param callback The callback that will be called when the extension callback task is executed.
1038-
*/
1039-
constructor(callback: (terminalRenderer: any, cancellationToken: CancellationToken, thisArg?: any) => Thenable<number>);
1040-
1041-
/**
1042-
* The callback used to execute the task.
1043-
* @param terminalRenderer Used by the task to render output and receive input.
1044-
* @param cancellationToken Cancellation used to signal a cancel request to the executing task.
1045-
* @returns The callback should return '0' for success and a non-zero value for failure.
1046-
*/
1047-
callback: (terminalRenderer: any, cancellationToken: CancellationToken, thisArg?: any) => Thenable<number>;
1048-
}
1049-
10501032
/**
10511033
* Class used to execute an extension callback as a task.
10521034
*/
@@ -1081,12 +1063,12 @@ declare module 'vscode' {
10811063
* or '$eslint'. Problem matchers can be contributed by an extension using
10821064
* the `problemMatchers` extension point.
10831065
*/
1084-
constructor(taskDefinition: TaskDefinition, scope: WorkspaceFolder | TaskScope.Global | TaskScope.Workspace, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution | CustomExecution2, problemMatchers?: string | string[]);
1066+
constructor(taskDefinition: TaskDefinition, scope: WorkspaceFolder | TaskScope.Global | TaskScope.Workspace, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution2, problemMatchers?: string | string[]);
10851067

10861068
/**
10871069
* The task's execution engine
10881070
*/
1089-
execution2?: ProcessExecution | ShellExecution | CustomExecution | CustomExecution2;
1071+
execution2?: ProcessExecution | ShellExecution | CustomExecution2;
10901072
}
10911073
//#endregion
10921074

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

Lines changed: 4 additions & 26 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, CustomExecutionDTO, CustomExecution2DTO, TaskDTO, TaskSourceDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO,
32+
ProcessExecutionDTO, ShellExecutionDTO, ShellExecutionOptionsDTO, CustomExecution2DTO, 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 | CustomExecutionDTO | CustomExecution2DTO): value is ProcessExecutionDTO {
134+
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecution2DTO): 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 | CustomExecutionDTO | CustomExecution2DTO): value is ShellExecutionDTO {
202+
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecution2DTO): value is ShellExecutionDTO {
203203
const candidate = value as ShellExecutionDTO;
204204
return candidate && (!!candidate.commandLine || !!candidate.command);
205205
}
@@ -230,28 +230,8 @@ namespace ShellExecutionDTO {
230230
}
231231
}
232232

233-
namespace CustomExecutionDTO {
234-
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO | CustomExecution2DTO): value is CustomExecutionDTO {
235-
const candidate = value as CustomExecutionDTO;
236-
return candidate && candidate.customExecution === 'customExecution';
237-
}
238-
239-
export function from(value: CommandConfiguration): CustomExecutionDTO {
240-
return {
241-
customExecution: 'customExecution'
242-
};
243-
}
244-
245-
export function to(value: CustomExecutionDTO): CommandConfiguration {
246-
return {
247-
runtime: RuntimeType.CustomExecution,
248-
presentation: undefined
249-
};
250-
}
251-
}
252-
253233
namespace CustomExecution2DTO {
254-
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO | CustomExecution2DTO): value is CustomExecution2DTO {
234+
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecution2DTO): value is CustomExecution2DTO {
255235
const candidate = value as CustomExecution2DTO;
256236
return candidate && candidate.customExecution === 'customExecution2';
257237
}
@@ -371,8 +351,6 @@ namespace TaskDTO {
371351
command = ShellExecutionDTO.to(task.execution);
372352
} else if (ProcessExecutionDTO.is(task.execution)) {
373353
command = ProcessExecutionDTO.to(task.execution);
374-
} else if (CustomExecutionDTO.is(task.execution)) {
375-
command = CustomExecutionDTO.to(task.execution);
376354
} else if (CustomExecution2DTO.is(task.execution)) {
377355
command = CustomExecution2DTO.to(task.execution);
378356
}

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

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,26 +1753,6 @@ export enum TaskScope {
17531753
Workspace = 2
17541754
}
17551755

1756-
export class CustomExecution implements vscode.CustomExecution {
1757-
private _callback: (args: any, cancellationToken: vscode.CancellationToken) => Thenable<number>;
1758-
1759-
constructor(callback: (args: any, cancellationToken: vscode.CancellationToken) => Thenable<number>) {
1760-
this._callback = callback;
1761-
}
1762-
1763-
public computeId(): string {
1764-
return 'customExecution' + generateUuid();
1765-
}
1766-
1767-
public set callback(value: (args: any, cancellationToken: vscode.CancellationToken) => Thenable<number>) {
1768-
this._callback = value;
1769-
}
1770-
1771-
public get callback(): (args: any, cancellationToken: vscode.CancellationToken) => Thenable<number> {
1772-
return this._callback;
1773-
}
1774-
}
1775-
17761756
export class CustomExecution2 implements vscode.CustomExecution2 {
17771757
private _callback: () => Thenable<vscode.Pseudoterminal>;
17781758
constructor(callback: () => Thenable<vscode.Pseudoterminal>) {
@@ -1804,7 +1784,7 @@ export class Task implements vscode.Task2 {
18041784
private _definition: vscode.TaskDefinition;
18051785
private _scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder | undefined;
18061786
private _name: string;
1807-
private _execution: ProcessExecution | ShellExecution | CustomExecution | CustomExecution2 | undefined;
1787+
private _execution: ProcessExecution | ShellExecution | CustomExecution2 | undefined;
18081788
private _problemMatchers: string[];
18091789
private _hasDefinedMatchers: boolean;
18101790
private _isBackground: boolean;
@@ -1813,8 +1793,8 @@ export class Task implements vscode.Task2 {
18131793
private _presentationOptions: vscode.TaskPresentationOptions;
18141794
private _runOptions: vscode.RunOptions;
18151795

1816-
constructor(definition: vscode.TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution | CustomExecution2, problemMatchers?: string | string[]);
1817-
constructor(definition: vscode.TaskDefinition, scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution | CustomExecution2, problemMatchers?: string | string[]);
1796+
constructor(definition: vscode.TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution2, problemMatchers?: string | string[]);
1797+
constructor(definition: vscode.TaskDefinition, scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution2, problemMatchers?: string | string[]);
18181798
constructor(definition: vscode.TaskDefinition, arg2: string | (vscode.TaskScope.Global | vscode.TaskScope.Workspace) | vscode.WorkspaceFolder, arg3: any, arg4?: any, arg5?: any, arg6?: any) {
18191799
this.definition = definition;
18201800
let problemMatchers: string | string[];
@@ -1879,7 +1859,7 @@ export class Task implements vscode.Task2 {
18791859
type: Task.ShellType,
18801860
id: this._execution.computeId()
18811861
};
1882-
} else if (this._execution instanceof CustomExecution) {
1862+
} else if (this._execution instanceof CustomExecution2) {
18831863
this._definition = {
18841864
type: Task.ExtensionCallbackType,
18851865
id: this._execution.computeId()
@@ -1926,18 +1906,18 @@ export class Task implements vscode.Task2 {
19261906
}
19271907

19281908
get execution(): ProcessExecution | ShellExecution | undefined {
1929-
return ((this._execution instanceof CustomExecution) || (this._execution instanceof CustomExecution2)) ? undefined : this._execution;
1909+
return (this._execution instanceof CustomExecution2) ? undefined : this._execution;
19301910
}
19311911

19321912
set execution(value: ProcessExecution | ShellExecution | undefined) {
19331913
this.execution2 = value;
19341914
}
19351915

1936-
get execution2(): ProcessExecution | ShellExecution | CustomExecution | CustomExecution2 | undefined {
1916+
get execution2(): ProcessExecution | ShellExecution | CustomExecution2 | undefined {
19371917
return this._execution;
19381918
}
19391919

1940-
set execution2(value: ProcessExecution | ShellExecution | CustomExecution | CustomExecution2 | undefined) {
1920+
set execution2(value: ProcessExecution | ShellExecution | CustomExecution2 | undefined) {
19411921
if (value === null) {
19421922
value = undefined;
19431923
}

src/vs/workbench/api/common/shared/tasks.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ export interface ShellExecutionDTO {
6666
options?: ShellExecutionOptionsDTO;
6767
}
6868

69-
export interface CustomExecutionDTO {
70-
customExecution: 'customExecution';
71-
}
72-
7369
export interface CustomExecution2DTO {
7470
customExecution: 'customExecution2';
7571
}
@@ -88,7 +84,7 @@ export interface TaskHandleDTO {
8884
export interface TaskDTO {
8985
_id: string;
9086
name?: string;
91-
execution: ProcessExecutionDTO | ShellExecutionDTO | CustomExecutionDTO | CustomExecution2DTO | undefined;
87+
execution: ProcessExecutionDTO | ShellExecutionDTO | CustomExecution2DTO | undefined;
9288
definition: TaskDefinitionDTO;
9389
isBackground?: boolean;
9490
source: TaskSourceDTO;
@@ -129,4 +125,4 @@ export interface TaskSystemInfoDTO {
129125
scheme: string;
130126
authority: string;
131127
platform: string;
132-
}
128+
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,6 @@ export function createApiFactory(
842842
EventEmitter: Emitter,
843843
ExtensionExecutionContext: extHostTypes.ExtensionExecutionContext,
844844
ExtensionKind: extHostTypes.ExtensionKind,
845-
CustomExecution: extHostTypes.CustomExecution,
846845
CustomExecution2: extHostTypes.CustomExecution2,
847846
FileChangeType: extHostTypes.FileChangeType,
848847
FileSystemError: extHostTypes.FileSystemError,

0 commit comments

Comments
 (0)