diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index ce6c93482ca..f78b6392341 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1029,24 +1029,6 @@ declare module 'vscode' { //#endregion //#region CustomExecution - /** - * Class used to execute an extension callback as a task. - */ - export class CustomExecution { - /** - * @param callback The callback that will be called when the extension callback task is executed. - */ - constructor(callback: (terminalRenderer: any, cancellationToken: CancellationToken, thisArg?: any) => Thenable); - - /** - * The callback used to execute the task. - * @param terminalRenderer Used by the task to render output and receive input. - * @param cancellationToken Cancellation used to signal a cancel request to the executing task. - * @returns The callback should return '0' for success and a non-zero value for failure. - */ - callback: (terminalRenderer: any, cancellationToken: CancellationToken, thisArg?: any) => Thenable; - } - /** * Class used to execute an extension callback as a task. */ @@ -1081,12 +1063,12 @@ declare module 'vscode' { * or '$eslint'. Problem matchers can be contributed by an extension using * the `problemMatchers` extension point. */ - constructor(taskDefinition: TaskDefinition, scope: WorkspaceFolder | TaskScope.Global | TaskScope.Workspace, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution | CustomExecution2, problemMatchers?: string | string[]); + constructor(taskDefinition: TaskDefinition, scope: WorkspaceFolder | TaskScope.Global | TaskScope.Workspace, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution2, problemMatchers?: string | string[]); /** * The task's execution engine */ - execution2?: ProcessExecution | ShellExecution | CustomExecution | CustomExecution2; + execution2?: ProcessExecution | ShellExecution | CustomExecution2; } //#endregion diff --git a/src/vs/workbench/api/browser/mainThreadTask.ts b/src/vs/workbench/api/browser/mainThreadTask.ts index 3e022e13cab..7934efb088b 100644 --- a/src/vs/workbench/api/browser/mainThreadTask.ts +++ b/src/vs/workbench/api/browser/mainThreadTask.ts @@ -29,7 +29,7 @@ import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers'; import { ExtHostContext, MainThreadTaskShape, ExtHostTaskShape, MainContext, IExtHostContext } from 'vs/workbench/api/common/extHost.protocol'; import { TaskDefinitionDTO, TaskExecutionDTO, ProcessExecutionOptionsDTO, TaskPresentationOptionsDTO, - ProcessExecutionDTO, ShellExecutionDTO, ShellExecutionOptionsDTO, CustomExecutionDTO, CustomExecution2DTO, TaskDTO, TaskSourceDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO, + ProcessExecutionDTO, ShellExecutionDTO, ShellExecutionOptionsDTO, CustomExecution2DTO, TaskDTO, TaskSourceDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO, RunOptionsDTO } from 'vs/workbench/api/common/shared/tasks'; import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; @@ -131,7 +131,7 @@ namespace ProcessExecutionOptionsDTO { } namespace ProcessExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO | CustomExecution2DTO): value is ProcessExecutionDTO { + export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecution2DTO): value is ProcessExecutionDTO { const candidate = value as ProcessExecutionDTO; return candidate && !!candidate.process; } @@ -199,7 +199,7 @@ namespace ShellExecutionOptionsDTO { } namespace ShellExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO | CustomExecution2DTO): value is ShellExecutionDTO { + export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecution2DTO): value is ShellExecutionDTO { const candidate = value as ShellExecutionDTO; return candidate && (!!candidate.commandLine || !!candidate.command); } @@ -230,28 +230,8 @@ namespace ShellExecutionDTO { } } -namespace CustomExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO | CustomExecution2DTO): value is CustomExecutionDTO { - const candidate = value as CustomExecutionDTO; - return candidate && candidate.customExecution === 'customExecution'; - } - - export function from(value: CommandConfiguration): CustomExecutionDTO { - return { - customExecution: 'customExecution' - }; - } - - export function to(value: CustomExecutionDTO): CommandConfiguration { - return { - runtime: RuntimeType.CustomExecution, - presentation: undefined - }; - } -} - namespace CustomExecution2DTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO | CustomExecution2DTO): value is CustomExecution2DTO { + export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecution2DTO): value is CustomExecution2DTO { const candidate = value as CustomExecution2DTO; return candidate && candidate.customExecution === 'customExecution2'; } @@ -371,8 +351,6 @@ namespace TaskDTO { command = ShellExecutionDTO.to(task.execution); } else if (ProcessExecutionDTO.is(task.execution)) { command = ProcessExecutionDTO.to(task.execution); - } else if (CustomExecutionDTO.is(task.execution)) { - command = CustomExecutionDTO.to(task.execution); } else if (CustomExecution2DTO.is(task.execution)) { command = CustomExecution2DTO.to(task.execution); } diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index 7cd821ea564..9ad1d38f66e 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -1753,26 +1753,6 @@ export enum TaskScope { Workspace = 2 } -export class CustomExecution implements vscode.CustomExecution { - private _callback: (args: any, cancellationToken: vscode.CancellationToken) => Thenable; - - constructor(callback: (args: any, cancellationToken: vscode.CancellationToken) => Thenable) { - this._callback = callback; - } - - public computeId(): string { - return 'customExecution' + generateUuid(); - } - - public set callback(value: (args: any, cancellationToken: vscode.CancellationToken) => Thenable) { - this._callback = value; - } - - public get callback(): (args: any, cancellationToken: vscode.CancellationToken) => Thenable { - return this._callback; - } -} - export class CustomExecution2 implements vscode.CustomExecution2 { private _callback: () => Thenable; constructor(callback: () => Thenable) { @@ -1804,7 +1784,7 @@ export class Task implements vscode.Task2 { private _definition: vscode.TaskDefinition; private _scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder | undefined; private _name: string; - private _execution: ProcessExecution | ShellExecution | CustomExecution | CustomExecution2 | undefined; + private _execution: ProcessExecution | ShellExecution | CustomExecution2 | undefined; private _problemMatchers: string[]; private _hasDefinedMatchers: boolean; private _isBackground: boolean; @@ -1813,8 +1793,8 @@ export class Task implements vscode.Task2 { private _presentationOptions: vscode.TaskPresentationOptions; private _runOptions: vscode.RunOptions; - constructor(definition: vscode.TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution | CustomExecution2, problemMatchers?: string | string[]); - 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[]); + constructor(definition: vscode.TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution2, problemMatchers?: string | string[]); + constructor(definition: vscode.TaskDefinition, scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution2, problemMatchers?: string | string[]); constructor(definition: vscode.TaskDefinition, arg2: string | (vscode.TaskScope.Global | vscode.TaskScope.Workspace) | vscode.WorkspaceFolder, arg3: any, arg4?: any, arg5?: any, arg6?: any) { this.definition = definition; let problemMatchers: string | string[]; @@ -1879,7 +1859,7 @@ export class Task implements vscode.Task2 { type: Task.ShellType, id: this._execution.computeId() }; - } else if (this._execution instanceof CustomExecution) { + } else if (this._execution instanceof CustomExecution2) { this._definition = { type: Task.ExtensionCallbackType, id: this._execution.computeId() @@ -1926,18 +1906,18 @@ export class Task implements vscode.Task2 { } get execution(): ProcessExecution | ShellExecution | undefined { - return ((this._execution instanceof CustomExecution) || (this._execution instanceof CustomExecution2)) ? undefined : this._execution; + return (this._execution instanceof CustomExecution2) ? undefined : this._execution; } set execution(value: ProcessExecution | ShellExecution | undefined) { this.execution2 = value; } - get execution2(): ProcessExecution | ShellExecution | CustomExecution | CustomExecution2 | undefined { + get execution2(): ProcessExecution | ShellExecution | CustomExecution2 | undefined { return this._execution; } - set execution2(value: ProcessExecution | ShellExecution | CustomExecution | CustomExecution2 | undefined) { + set execution2(value: ProcessExecution | ShellExecution | CustomExecution2 | undefined) { if (value === null) { value = undefined; } diff --git a/src/vs/workbench/api/common/shared/tasks.ts b/src/vs/workbench/api/common/shared/tasks.ts index a27f90777d3..b8fab0b5a02 100644 --- a/src/vs/workbench/api/common/shared/tasks.ts +++ b/src/vs/workbench/api/common/shared/tasks.ts @@ -66,10 +66,6 @@ export interface ShellExecutionDTO { options?: ShellExecutionOptionsDTO; } -export interface CustomExecutionDTO { - customExecution: 'customExecution'; -} - export interface CustomExecution2DTO { customExecution: 'customExecution2'; } @@ -88,7 +84,7 @@ export interface TaskHandleDTO { export interface TaskDTO { _id: string; name?: string; - execution: ProcessExecutionDTO | ShellExecutionDTO | CustomExecutionDTO | CustomExecution2DTO | undefined; + execution: ProcessExecutionDTO | ShellExecutionDTO | CustomExecution2DTO | undefined; definition: TaskDefinitionDTO; isBackground?: boolean; source: TaskSourceDTO; @@ -129,4 +125,4 @@ export interface TaskSystemInfoDTO { scheme: string; authority: string; platform: string; -} \ No newline at end of file +} diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index 1d7028491d0..e2bd21dfcf4 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -842,7 +842,6 @@ export function createApiFactory( EventEmitter: Emitter, ExtensionExecutionContext: extHostTypes.ExtensionExecutionContext, ExtensionKind: extHostTypes.ExtensionKind, - CustomExecution: extHostTypes.CustomExecution, CustomExecution2: extHostTypes.CustomExecution2, FileChangeType: extHostTypes.FileChangeType, FileSystemError: extHostTypes.FileSystemError, diff --git a/src/vs/workbench/api/node/extHostTask.ts b/src/vs/workbench/api/node/extHostTask.ts index f9ebaec4b50..6655e30153e 100644 --- a/src/vs/workbench/api/node/extHostTask.ts +++ b/src/vs/workbench/api/node/extHostTask.ts @@ -21,17 +21,15 @@ import { TaskDefinitionDTO, TaskExecutionDTO, TaskPresentationOptionsDTO, ProcessExecutionOptionsDTO, ProcessExecutionDTO, ShellExecutionOptionsDTO, ShellExecutionDTO, - CustomExecutionDTO, CustomExecution2DTO, TaskDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO, TaskSetDTO } from '../common/shared/tasks'; import { ExtHostVariableResolverService } from 'vs/workbench/api/node/extHostDebugService'; import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors'; import { ExtHostConfiguration } from 'vs/workbench/api/common/extHostConfiguration'; -import { ExtHostTerminalService, ExtHostTerminal } from 'vs/workbench/api/node/extHostTerminalService'; +import { ExtHostTerminalService } from 'vs/workbench/api/node/extHostTerminalService'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; -import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation'; -import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle'; +import { CancellationToken } from 'vs/base/common/cancellation'; import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; namespace TaskDefinitionDTO { @@ -80,7 +78,7 @@ namespace ProcessExecutionOptionsDTO { } namespace ProcessExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO | CustomExecution2DTO | undefined): value is ProcessExecutionDTO { + export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecution2DTO | undefined): value is ProcessExecutionDTO { if (value) { const candidate = value as ProcessExecutionDTO; return candidate && !!candidate.process; @@ -125,7 +123,7 @@ namespace ShellExecutionOptionsDTO { } namespace ShellExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO | CustomExecution2DTO | undefined): value is ShellExecutionDTO { + export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecution2DTO | undefined): value is ShellExecutionDTO { if (value) { const candidate = value as ShellExecutionDTO; return candidate && (!!candidate.commandLine || !!candidate.command); @@ -162,25 +160,8 @@ namespace ShellExecutionDTO { } } -namespace CustomExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO | CustomExecution2DTO | undefined): value is CustomExecutionDTO { - if (value) { - let candidate = value as CustomExecutionDTO; - return candidate && candidate.customExecution === 'customExecution'; - } else { - return false; - } - } - - export function from(value: vscode.CustomExecution): CustomExecutionDTO { - return { - customExecution: 'customExecution' - }; - } -} - namespace CustomExecution2DTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO | CustomExecution2DTO | undefined): value is CustomExecution2DTO { + export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecution2DTO | undefined): value is CustomExecution2DTO { if (value) { let candidate = value as CustomExecution2DTO; return candidate && candidate.customExecution === 'customExecution2'; @@ -229,13 +210,11 @@ namespace TaskDTO { if (value === undefined || value === null) { return undefined; } - let execution: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO | CustomExecution2DTO | undefined; + let execution: ShellExecutionDTO | ProcessExecutionDTO | CustomExecution2DTO | undefined; if (value.execution instanceof types.ProcessExecution) { execution = ProcessExecutionDTO.from(value.execution); } else if (value.execution instanceof types.ShellExecution) { execution = ShellExecutionDTO.from(value.execution); - } else if ((value).execution2 && (value).execution2 instanceof types.CustomExecution) { - execution = CustomExecutionDTO.from((value).execution2); } else if ((value).execution2 && (value).execution2 instanceof types.CustomExecution2) { execution = CustomExecution2DTO.from((value).execution2); } @@ -373,110 +352,6 @@ interface HandlerData { extension: IExtensionDescription; } -class CustomExecutionData implements IDisposable { - private static waitForDimensionsTimeoutInMs: number = 5000; - private _cancellationSource?: CancellationTokenSource; - private readonly _onTaskExecutionComplete: Emitter = new Emitter(); - private readonly _disposables = new DisposableStore(); - private terminal?: vscode.Terminal; - private terminalId?: number; - public result: number | undefined; - - constructor( - private readonly customExecution: vscode.CustomExecution, - private readonly terminalService: ExtHostTerminalService) { - } - - public dispose(): void { - this._cancellationSource = undefined; - this._disposables.dispose(); - } - - public get onTaskExecutionComplete(): Event { - return this._onTaskExecutionComplete.event; - } - - private onDidCloseTerminal(terminal: vscode.Terminal): void { - if ((this.terminal === terminal) && this._cancellationSource) { - this._cancellationSource.cancel(); - } - } - - private onDidOpenTerminal(terminal: vscode.Terminal): void { - if (!(terminal instanceof ExtHostTerminal)) { - throw new Error('How could this not be a extension host terminal?'); - } - - if (this.terminalId && terminal._id === this.terminalId) { - this.startCallback(this.terminalId); - } - } - - public async startCallback(terminalId: number): Promise { - this.terminalId = terminalId; - - // If we have already started the extension task callback, then - // do not start it again. - // It is completely valid for multiple terminals to be opened - // before the one for our task. - if (this._cancellationSource) { - return undefined; - } - - const callbackTerminals: vscode.Terminal[] = this.terminalService.terminals.filter((terminal) => terminal._id === terminalId); - - if (!callbackTerminals || callbackTerminals.length === 0) { - this._disposables.add(this.terminalService.onDidOpenTerminal(this.onDidOpenTerminal.bind(this))); - return; - } - - if (callbackTerminals.length !== 1) { - throw new Error(`Expected to only have one terminal at this point`); - } - - this.terminal = callbackTerminals[0]; - const terminalRenderer: any = await this.terminalService.resolveTerminalRenderer(terminalId); - - // If we don't have the maximum dimensions yet, then we need to wait for them (but not indefinitely). - // Custom executions will expect the dimensions to be set properly before they are launched. - // BUT, due to the API contract VSCode has for terminals and dimensions, they are still responsible for - // handling cases where they are not set. - if (!terminalRenderer.maximumDimensions) { - const dimensionTimeout: Promise = new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, CustomExecutionData.waitForDimensionsTimeoutInMs); - }); - - let dimensionsRegistration: IDisposable | undefined; - const dimensionsPromise: Promise = new Promise((resolve) => { - dimensionsRegistration = terminalRenderer.onDidChangeMaximumDimensions(() => { - resolve(); - }); - }); - - await Promise.race([dimensionTimeout, dimensionsPromise]); - if (dimensionsRegistration) { - dimensionsRegistration.dispose(); - } - } - - this._cancellationSource = new CancellationTokenSource(); - this._disposables.add(this._cancellationSource); - - this._disposables.add(this.terminalService.onDidCloseTerminal(this.onDidCloseTerminal.bind(this))); - - // Regardless of how the task completes, we are done with this custom execution task. - this.customExecution.callback(terminalRenderer, this._cancellationSource.token).then( - (success) => { - this.result = success; - this._onTaskExecutionComplete.fire(this); - }, (rejected) => { - this._onTaskExecutionComplete.fire(this); - }); - } -} - export class ExtHostTask implements ExtHostTaskShape { private _proxy: MainThreadTaskShape; @@ -487,8 +362,6 @@ export class ExtHostTask implements ExtHostTaskShape { private _handleCounter: number; private _handlers: Map; private _taskExecutions: Map; - private _providedCustomExecutions: Map; - private _activeCustomExecutions: Map; private _providedCustomExecutions2: Map; private _activeCustomExecutions2: Map; @@ -512,8 +385,6 @@ export class ExtHostTask implements ExtHostTaskShape { this._handleCounter = 0; this._handlers = new Map(); this._taskExecutions = new Map(); - this._providedCustomExecutions = new Map(); - this._activeCustomExecutions = new Map(); this._providedCustomExecutions2 = new Map(); this._activeCustomExecutions2 = new Map(); } @@ -591,25 +462,6 @@ export class ExtHostTask implements ExtHostTaskShape { await this._terminalService.attachPtyToTerminal(terminalId, await execution2.callback()); } - // Once a terminal is spun up for the custom execution task this event will be fired. - // At that point, we need to actually start the callback, but - // only if it hasn't already begun. - const extensionCallback: CustomExecutionData | undefined = this._providedCustomExecutions.get(execution.id); - if (extensionCallback) { - if (this._activeCustomExecutions.get(execution.id) !== undefined) { - throw new Error('We should not be trying to start the same custom task executions twice.'); - } - - this._activeCustomExecutions.set(execution.id, extensionCallback); - - const taskExecutionComplete: IDisposable = extensionCallback.onTaskExecutionComplete(() => { - this.customExecutionComplete(execution); - taskExecutionComplete.dispose(); - }); - - extensionCallback.startCallback(terminalId); - } - this._onDidExecuteTask.fire({ execution: await this.getTaskExecution(execution) }); @@ -665,7 +517,6 @@ export class ExtHostTask implements ExtHostTaskShape { // For custom execution tasks, we need to store the execution objects locally // since we obviously cannot send callback functions through the proxy. // So, clear out any existing ones. - this._providedCustomExecutions.clear(); this._providedCustomExecutions2.clear(); // Set up a list of task ID promises that we can wait on @@ -689,14 +540,11 @@ export class ExtHostTask implements ExtHostTaskShape { if (taskDTO) { taskDTOs.push(taskDTO); - if (CustomExecutionDTO.is(taskDTO.execution)) { + if (CustomExecution2DTO.is(taskDTO.execution)) { // The ID is calculated on the main thread task side, so, let's call into it here. // We need the task id's pre-computed for custom task executions because when OnDidStartTask // is invoked, we have to be able to map it back to our data. - taskIdPromises.push(this.addCustomExecution(taskDTO, task)); - } else if (CustomExecution2DTO.is(taskDTO.execution)) { taskIdPromises.push(this.addCustomExecution2(taskDTO, task)); - } } } @@ -745,10 +593,6 @@ export class ExtHostTask implements ExtHostTaskShape { throw new Error('Unexpected: The resolved task definition must be the same object as the original task definition. The task definition cannot be changed.'); } - if (CustomExecutionDTO.is(resolvedTaskDTO.execution)) { - await this.addCustomExecution(resolvedTaskDTO, resolvedTask); - } - if (CustomExecution2DTO.is(resolvedTaskDTO.execution)) { await this.addCustomExecution2(resolvedTaskDTO, resolvedTask); } @@ -801,11 +645,6 @@ export class ExtHostTask implements ExtHostTaskShape { return this._handleCounter++; } - private async addCustomExecution(taskDTO: TaskDTO, task: vscode.Task2): Promise { - const taskId = await this._proxy.$createTaskId(taskDTO); - this._providedCustomExecutions.set(taskId, new CustomExecutionData((task).execution2, this._terminalService)); - } - private async addCustomExecution2(taskDTO: TaskDTO, task: vscode.Task2): Promise { const taskId = await this._proxy.$createTaskId(taskDTO); this._providedCustomExecutions2.set(taskId, (task).execution2); @@ -834,12 +673,6 @@ export class ExtHostTask implements ExtHostTaskShape { } private customExecutionComplete(execution: TaskExecutionDTO): void { - const extensionCallback: CustomExecutionData | undefined = this._activeCustomExecutions.get(execution.id); - if (extensionCallback) { - this._activeCustomExecutions.delete(execution.id); - this._proxy.$customExecutionComplete(execution.id, extensionCallback.result); - extensionCallback.dispose(); - } const extensionCallback2: vscode.CustomExecution2 | undefined = this._activeCustomExecutions2.get(execution.id); if (extensionCallback2) { this._activeCustomExecutions2.delete(execution.id); diff --git a/src/vs/workbench/api/node/extHostTerminalService.ts b/src/vs/workbench/api/node/extHostTerminalService.ts index a0bdd8ecc05..d8334b47d4d 100644 --- a/src/vs/workbench/api/node/extHostTerminalService.ts +++ b/src/vs/workbench/api/node/extHostTerminalService.ts @@ -290,11 +290,6 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape { return terminalEnvironment.getDefaultShellArgs(fetchSetting, this._isWorkspaceShellAllowed, this._lastActiveWorkspace, this._variableResolver, this._logService); } - // TODO: Remove when CustomExecution is removed - public async resolveTerminalRenderer(id: number): Promise { - throw new Error('TerminalRenderers are no longer supported'); - } - public $acceptActiveTerminalChanged(id: number | null): void { const original = this._activeTerminal; if (id === null) { diff --git a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts index 6bccee3e09f..2559188da9e 100644 --- a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts +++ b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts @@ -472,7 +472,7 @@ export class TerminalTaskSystem implements ITaskSystem { const resolvedVariables = this.resolveVariablesFromSet(systemInfo, workspaceFolder, task, variables); return resolvedVariables.then((resolvedVariables) => { - const isCustomExecution = (task.command.runtime === RuntimeType.CustomExecution) || (task.command.runtime === RuntimeType.CustomExecution2); + const isCustomExecution = (task.command.runtime === RuntimeType.CustomExecution2); if (resolvedVariables && (task.command !== undefined) && task.command.runtime && (isCustomExecution || (task.command.name !== undefined))) { this.currentTask.resolvedVariables = resolvedVariables; return this.executeInTerminal(task, trigger, new VariableResolver(workspaceFolder, systemInfo, resolvedVariables.variables, this.configurationResolverService), workspaceFolder); @@ -556,9 +556,7 @@ export class TerminalTaskSystem implements ITaskSystem { let processStartedSignaled = false; terminal.processReady.then(() => { if (!processStartedSignaled) { - if (task.command.runtime !== RuntimeType.CustomExecution) { - this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.ProcessStarted, task, terminal!.processId!)); - } + this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.ProcessStarted, task, terminal!.processId!)); processStartedSignaled = true; } }, (_error) => { @@ -608,9 +606,7 @@ export class TerminalTaskSystem implements ITaskSystem { processStartedSignaled = true; } - if (task.command.runtime !== RuntimeType.CustomExecution) { - this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.ProcessEnded, task, exitCode)); - } + this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.ProcessEnded, task, exitCode)); for (let i = 0; i < eventCounter; i++) { let event = TaskEvent.create(TaskEventKind.Inactive, task); @@ -635,9 +631,7 @@ export class TerminalTaskSystem implements ITaskSystem { let processStartedSignaled = false; terminal.processReady.then(() => { if (!processStartedSignaled) { - if (task.command.runtime !== RuntimeType.CustomExecution) { - this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.ProcessStarted, task, terminal!.processId!)); - } + this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.ProcessStarted, task, terminal!.processId!)); processStartedSignaled = true; } }, (_error) => { @@ -690,9 +684,8 @@ export class TerminalTaskSystem implements ITaskSystem { this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.ProcessStarted, task, terminal.processId!)); processStartedSignaled = true; } - if (task.command.runtime !== RuntimeType.CustomExecution) { - this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.ProcessEnded, task, exitCode)); - } + + this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.ProcessEnded, task, exitCode)); this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.Inactive, task)); this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.End, task)); resolve({ exitCode }); @@ -845,7 +838,7 @@ export class TerminalTaskSystem implements ITaskSystem { } } } else { - let commandExecutable = ((task.command.runtime !== RuntimeType.CustomExecution) && (task.command.runtime !== RuntimeType.CustomExecution2)) ? CommandString.value(command) : undefined; + let commandExecutable = (task.command.runtime !== RuntimeType.CustomExecution2) ? CommandString.value(command) : undefined; let executable = !isShellCommand ? this.resolveVariable(variableResolver, '${' + TerminalTaskSystem.ProcessVarName + '}') : commandExecutable; @@ -917,15 +910,7 @@ export class TerminalTaskSystem implements ITaskSystem { let args: CommandString[] | undefined; let launchConfigs: IShellLaunchConfig | undefined; - if (task.command.runtime === RuntimeType.CustomExecution) { - throw new Error('CustomExecution is no longer supported'); - // this.currentTask.shellLaunchConfig = launchConfigs = { - // isRendererOnly: true, - // waitOnExit, - // name: this.createTerminalName(task, workspaceFolder), - // initialText: task.command.presentation && task.command.presentation.echo ? `\x1b[1m> Executing task: ${task._label} <\x1b[0m\n` : undefined - // }; - } else if (task.command.runtime === RuntimeType.CustomExecution2) { + if (task.command.runtime === RuntimeType.CustomExecution2) { this.currentTask.shellLaunchConfig = launchConfigs = { isExtensionTerminal: true, waitOnExit, @@ -1146,7 +1131,7 @@ export class TerminalTaskSystem implements ITaskSystem { private collectCommandVariables(variables: Set, command: CommandConfiguration, task: CustomTask | ContributedTask): void { // The custom execution should have everything it needs already as it provided // the callback. - if ((command.runtime === RuntimeType.CustomExecution) || (command.runtime === RuntimeType.CustomExecution2)) { + if (command.runtime === RuntimeType.CustomExecution2) { return; } diff --git a/src/vs/workbench/contrib/tasks/common/tasks.ts b/src/vs/workbench/contrib/tasks/common/tasks.ts index decd333ab72..46593df22be 100644 --- a/src/vs/workbench/contrib/tasks/common/tasks.ts +++ b/src/vs/workbench/contrib/tasks/common/tasks.ts @@ -273,8 +273,7 @@ export namespace PresentationOptions { export enum RuntimeType { Shell = 1, Process = 2, - CustomExecution = 3, - CustomExecution2 = 4 + CustomExecution2 = 3 } export namespace RuntimeType { @@ -284,8 +283,6 @@ export namespace RuntimeType { return RuntimeType.Shell; case 'process': return RuntimeType.Process; - case 'customExecution': - return RuntimeType.CustomExecution; case 'customExecution2': return RuntimeType.CustomExecution2; default: @@ -663,10 +660,6 @@ export class CustomTask extends CommonTask { type = 'process'; break; - case RuntimeType.CustomExecution: - type = 'customExecution'; - break; - case RuntimeType.CustomExecution2: type = 'customExecution2'; break; diff --git a/src/vs/workbench/contrib/tasks/node/processTaskSystem.ts b/src/vs/workbench/contrib/tasks/node/processTaskSystem.ts index 972b7ec3374..8110db9d80c 100644 --- a/src/vs/workbench/contrib/tasks/node/processTaskSystem.ts +++ b/src/vs/workbench/contrib/tasks/node/processTaskSystem.ts @@ -280,7 +280,7 @@ export class ProcessTaskSystem implements ITaskSystem { this.childProcessEnded(); watchingProblemMatcher.done(); watchingProblemMatcher.dispose(); - if (processStartedSignaled && task.command.runtime !== RuntimeType.CustomExecution) { + if (processStartedSignaled) { this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.ProcessEnded, task, success.cmdCode!)); } toDispose = dispose(toDispose!); @@ -336,7 +336,7 @@ export class ProcessTaskSystem implements ITaskSystem { startStopProblemMatcher.done(); startStopProblemMatcher.dispose(); this.checkTerminated(task, success); - if (processStartedSignaled && task.command.runtime !== RuntimeType.CustomExecution) { + if (processStartedSignaled) { this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.ProcessEnded, task, success.cmdCode!)); } this._onDidStateChange.fire(inactiveEvent);