diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index a7d71d01d99..c11f5987e2c 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1184,7 +1184,7 @@ declare module 'vscode' { /** * Class used to execute an extension callback as a task. */ - export class CustomTaskExecution { + export class CustomExecution { /** * @param callback The callback that will be called when the extension callback task is executed. */ @@ -1199,7 +1199,7 @@ declare module 'vscode' { /** * A task to execute */ - export class TaskWithCustomTaskExecution extends Task { + export class Task2 extends Task { /** * Creates a new task. * @@ -1212,12 +1212,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 | CustomTaskExecution, problemMatchers?: string | string[]); + constructor(taskDefinition: TaskDefinition, scope: WorkspaceFolder | TaskScope.Global | TaskScope.Workspace, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution, problemMatchers?: string | string[]); /** * The task's execution engine */ - executionWithExtensionCallback?: ProcessExecution | ShellExecution | CustomTaskExecution; + execution2?: ProcessExecution | ShellExecution | CustomExecution; } //#region Tasks diff --git a/src/vs/workbench/api/electron-browser/mainThreadTask.ts b/src/vs/workbench/api/electron-browser/mainThreadTask.ts index 344f03f96d6..893d864fe10 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadTask.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadTask.ts @@ -30,7 +30,7 @@ import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostC import { ExtHostContext, MainThreadTaskShape, ExtHostTaskShape, MainContext, IExtHostContext } from 'vs/workbench/api/node/extHost.protocol'; import { TaskDefinitionDTO, TaskExecutionDTO, ProcessExecutionOptionsDTO, TaskPresentationOptionsDTO, - ProcessExecutionDTO, ShellExecutionDTO, ShellExecutionOptionsDTO, CustomTaskExecutionDTO, TaskDTO, TaskSourceDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO, + ProcessExecutionDTO, ShellExecutionDTO, ShellExecutionOptionsDTO, CustomExecutionDTO, TaskDTO, TaskSourceDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO, RunOptionsDTO } from 'vs/workbench/api/shared/tasks'; import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; @@ -138,7 +138,7 @@ namespace ProcessExecutionOptionsDTO { } namespace ProcessExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomTaskExecutionDTO): value is ProcessExecutionDTO { + export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is ProcessExecutionDTO { let candidate = value as ProcessExecutionDTO; return candidate && !!candidate.process; } @@ -206,7 +206,7 @@ namespace ShellExecutionOptionsDTO { } namespace ShellExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomTaskExecutionDTO): value is ShellExecutionDTO { + export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is ShellExecutionDTO { let candidate = value as ShellExecutionDTO; return candidate && (!!candidate.commandLine || !!candidate.command); } @@ -237,21 +237,21 @@ namespace ShellExecutionDTO { } } -namespace CustomTaskExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomTaskExecutionDTO): value is CustomTaskExecutionDTO { - let candidate = value as CustomTaskExecutionDTO; - return candidate && candidate.customTaskExecution === 'customTaskExecution'; +namespace CustomExecutionDTO { + export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is CustomExecutionDTO { + let candidate = value as CustomExecutionDTO; + return candidate && candidate.customExecution === 'customExecution'; } - export function from(value: CommandConfiguration): CustomTaskExecutionDTO { + export function from(value: CommandConfiguration): CustomExecutionDTO { return { - customTaskExecution: 'customTaskExecution' + customExecution: 'customExecution' }; } - export function to(value: CustomTaskExecutionDTO): CommandConfiguration { + export function to(value: CustomExecutionDTO): CommandConfiguration { return { - runtime: RuntimeType.CustomTaskExecution, + runtime: RuntimeType.CustomExecution, presentation: undefined }; } @@ -358,8 +358,8 @@ namespace TaskDTO { command = ShellExecutionDTO.to(task.execution); } else if (ProcessExecutionDTO.is(task.execution)) { command = ProcessExecutionDTO.to(task.execution); - } else if (CustomTaskExecutionDTO.is(task.execution)) { - command = CustomTaskExecutionDTO.to(task.execution); + } else if (CustomExecutionDTO.is(task.execution)) { + command = CustomExecutionDTO.to(task.execution); } } @@ -518,7 +518,7 @@ export class MainThreadTask implements MainThreadTaskShape { }); } - public $customTaskExecutionComplete(id: string, result?: number): Promise { + public $customExecutionComplete(id: string, result?: number): Promise { return new Promise((resolve, reject) => { this._taskService.getActiveTasks().then((tasks) => { for (let task of tasks) { diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index ae5711c453c..eec38cbcfa9 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -783,7 +783,7 @@ export function createApiFactory( DocumentSymbol: extHostTypes.DocumentSymbol, EndOfLine: extHostTypes.EndOfLine, EventEmitter: Emitter, - CustomTaskExecution: extHostTypes.CustomTaskExecution, + CustomExecution: extHostTypes.CustomExecution, FileChangeType: extHostTypes.FileChangeType, FileSystemError: extHostTypes.FileSystemError, FileType: files.FileType, @@ -819,7 +819,7 @@ export function createApiFactory( SymbolInformation: extHostTypes.SymbolInformation, SymbolKind: extHostTypes.SymbolKind, Task: extHostTypes.Task, - TaskWithCustomTaskExecution: extHostTypes.Task, + Task2: extHostTypes.Task, TaskGroup: extHostTypes.TaskGroup, TaskPanelKind: extHostTypes.TaskPanelKind, TaskRevealKind: extHostTypes.TaskRevealKind, diff --git a/src/vs/workbench/api/node/extHost.protocol.ts b/src/vs/workbench/api/node/extHost.protocol.ts index 28e71142d2e..6b6d00970a0 100644 --- a/src/vs/workbench/api/node/extHost.protocol.ts +++ b/src/vs/workbench/api/node/extHost.protocol.ts @@ -556,7 +556,7 @@ export interface MainThreadTaskShape extends IDisposable { $executeTask(task: TaskHandleDTO | TaskDTO): Promise; $terminateTask(id: string): Promise; $registerTaskSystem(scheme: string, info: TaskSystemInfoDTO): void; - $customTaskExecutionComplete(id: string, result?: number): Promise; + $customExecutionComplete(id: string, result?: number): Promise; } export interface MainThreadExtensionServiceShape extends IDisposable { diff --git a/src/vs/workbench/api/node/extHostTask.ts b/src/vs/workbench/api/node/extHostTask.ts index 6713812a53a..1e7656efab5 100644 --- a/src/vs/workbench/api/node/extHostTask.ts +++ b/src/vs/workbench/api/node/extHostTask.ts @@ -22,7 +22,7 @@ import { TaskDefinitionDTO, TaskExecutionDTO, TaskPresentationOptionsDTO, ProcessExecutionOptionsDTO, ProcessExecutionDTO, ShellExecutionOptionsDTO, ShellExecutionDTO, - CustomTaskExecutionDTO, + CustomExecutionDTO, TaskDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO, TaskSetDTO } from '../shared/tasks'; import { ExtHostVariableResolverService } from 'vs/workbench/api/node/extHostDebugService'; @@ -79,7 +79,7 @@ namespace ProcessExecutionOptionsDTO { } namespace ProcessExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomTaskExecutionDTO): value is ProcessExecutionDTO { + export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is ProcessExecutionDTO { let candidate = value as ProcessExecutionDTO; return candidate && !!candidate.process; } @@ -120,7 +120,7 @@ namespace ShellExecutionOptionsDTO { } namespace ShellExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomTaskExecutionDTO): value is ShellExecutionDTO { + export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is ShellExecutionDTO { let candidate = value as ShellExecutionDTO; return candidate && (!!candidate.commandLine || !!candidate.command); } @@ -153,15 +153,15 @@ namespace ShellExecutionDTO { } } -namespace CustomTaskExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomTaskExecutionDTO): value is CustomTaskExecutionDTO { - let candidate = value as CustomTaskExecutionDTO; - return candidate && candidate.customTaskExecution === 'customTaskExecution'; +namespace CustomExecutionDTO { + export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is CustomExecutionDTO { + let candidate = value as CustomExecutionDTO; + return candidate && candidate.customExecution === 'customExecution'; } - export function from(value: vscode.CustomTaskExecution): CustomTaskExecutionDTO { + export function from(value: vscode.CustomExecution): CustomExecutionDTO { return { - customTaskExecution: 'customTaskExecution' + customExecution: 'customExecution' }; } } @@ -199,13 +199,13 @@ namespace TaskDTO { if (value === undefined || value === null) { return undefined; } - let execution: ShellExecutionDTO | ProcessExecutionDTO | CustomTaskExecutionDTO; + let execution: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO; 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).executionWithExtensionCallback && (value).executionWithExtensionCallback instanceof types.CustomTaskExecution) { - execution = CustomTaskExecutionDTO.from((value).executionWithExtensionCallback); + } else if ((value).execution2 && (value).execution2 instanceof types.CustomExecution) { + execution = CustomExecutionDTO.from((value).execution2); } let definition: TaskDefinitionDTO = TaskDefinitionDTO.from(value.definition); @@ -336,16 +336,16 @@ interface HandlerData { extension: IExtensionDescription; } -class CustomTaskExecutionData implements IDisposable { +class CustomExecutionData implements IDisposable { private _cancellationSource?: CancellationTokenSource; - private readonly _onTaskExecutionComplete: Emitter = new Emitter(); + private readonly _onTaskExecutionComplete: Emitter = new Emitter(); private readonly _disposables: IDisposable[] = []; private terminal?: vscode.Terminal; private terminalId?: number; public result: number | undefined; constructor( - private readonly callbackData: vscode.CustomTaskExecution, + private readonly callbackData: vscode.CustomExecution, private readonly terminalService: ExtHostTerminalService) { } @@ -353,7 +353,7 @@ class CustomTaskExecutionData implements IDisposable { dispose(this._disposables); } - public get onTaskExecutionComplete(): Event { + public get onTaskExecutionComplete(): Event { return this._onTaskExecutionComplete.event; } @@ -396,7 +396,7 @@ class CustomTaskExecutionData implements IDisposable { } this.terminal = callbackTerminals[0]; - const terminalRenderer: vscode.TerminalRenderer = await this.terminalService.createTerminalRendererForTerminal(this.terminal); + const terminalRenderer: vscode.TerminalRenderer = await this.terminalService.resolveTerminalRenderer(terminalId); this._cancellationSource = new CancellationTokenSource(); this._disposables.push(this._cancellationSource); @@ -424,8 +424,8 @@ export class ExtHostTask implements ExtHostTaskShape { private _handleCounter: number; private _handlers: Map; private _taskExecutions: Map; - private _providedCustomTaskExecutions: Map; - private _activeCustomTaskExecutions: Map; + private _providedCustomExecutions: Map; + private _activeCustomExecutions: Map; private readonly _onDidExecuteTask: Emitter = new Emitter(); private readonly _onDidTerminateTask: Emitter = new Emitter(); @@ -447,8 +447,8 @@ export class ExtHostTask implements ExtHostTaskShape { this._handleCounter = 0; this._handlers = new Map(); this._taskExecutions = new Map(); - this._providedCustomTaskExecutions = new Map(); - this._activeCustomTaskExecutions = new Map(); + this._providedCustomExecutions = new Map(); + this._activeCustomExecutions = new Map(); } public registerTaskProvider(extension: IExtensionDescription, provider: vscode.TaskProvider): vscode.Disposable { @@ -518,16 +518,16 @@ export class ExtHostTask implements ExtHostTaskShape { // 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: CustomTaskExecutionData | undefined = this._providedCustomTaskExecutions.get(execution.id); + const extensionCallback: CustomExecutionData | undefined = this._providedCustomExecutions.get(execution.id); if (extensionCallback) { - if (this._activeCustomTaskExecutions.get(execution.id) !== undefined) { + if (this._activeCustomExecutions.get(execution.id) !== undefined) { throw new Error('We should not be trying to start the same custom task executions twice.'); } - this._activeCustomTaskExecutions.set(execution.id, extensionCallback); + this._activeCustomExecutions.set(execution.id, extensionCallback); const taskExecutionComplete: IDisposable = extensionCallback.onTaskExecutionComplete(() => { - this.customTaskExecutionComplete(execution); + this.customExecutionComplete(execution); taskExecutionComplete.dispose(); }); @@ -548,7 +548,7 @@ export class ExtHostTask implements ExtHostTaskShape { const workspaceProvider = await this._workspaceService.getWorkspaceProvider(); const _execution = this.getTaskExecution(execution, workspaceProvider); this._taskExecutions.delete(execution.id); - this.customTaskExecutionComplete(execution); + this.customExecutionComplete(execution); this._onDidTerminateTask.fire({ execution: _execution }); @@ -593,7 +593,7 @@ 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._providedCustomTaskExecutions.clear(); + this._providedCustomExecutions.clear(); // Set up a list of task ID promises that we can wait on // before returning the provided tasks. The ensures that @@ -614,13 +614,13 @@ export class ExtHostTask implements ExtHostTaskShape { const taskDTO: TaskDTO = TaskDTO.from(task, handler.extension); taskDTOs.push(taskDTO); - if (CustomTaskExecutionDTO.is(taskDTO.execution)) { + if (CustomExecutionDTO.is(taskDTO.execution)) { taskIdPromises.push(new Promise((resolve) => { // 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. this._proxy.$createTaskId(taskDTO).then((taskId) => { - this._providedCustomTaskExecutions.set(taskId, new CustomTaskExecutionData((task).executionWithExtensionCallback, this._terminalService)); + this._providedCustomExecutions.set(taskId, new CustomExecutionData((task).execution2, this._terminalService)); resolve(); }); })); @@ -698,11 +698,11 @@ export class ExtHostTask implements ExtHostTaskShape { return result; } - private customTaskExecutionComplete(execution: TaskExecutionDTO): void { - const extensionCallback: CustomTaskExecutionData | undefined = this._activeCustomTaskExecutions.get(execution.id); + private customExecutionComplete(execution: TaskExecutionDTO): void { + const extensionCallback: CustomExecutionData | undefined = this._activeCustomExecutions.get(execution.id); if (extensionCallback) { - this._activeCustomTaskExecutions.delete(execution.id); - this._proxy.$customTaskExecutionComplete(execution.id, extensionCallback.result); + this._activeCustomExecutions.delete(execution.id); + this._proxy.$customExecutionComplete(execution.id, extensionCallback.result); extensionCallback.dispose(); } } diff --git a/src/vs/workbench/api/node/extHostTerminalService.ts b/src/vs/workbench/api/node/extHostTerminalService.ts index fe3457e5f8b..18783abf84b 100644 --- a/src/vs/workbench/api/node/extHostTerminalService.ts +++ b/src/vs/workbench/api/node/extHostTerminalService.ts @@ -332,18 +332,16 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape { return renderer; } - public async createTerminalRendererForTerminal(terminal: vscode.Terminal): Promise { - if (!(terminal instanceof ExtHostTerminal)) { - throw new Error('Only expected instance extension host terminal type'); - } + public async resolveTerminalRenderer(id: number): Promise { // Check to see if the extension host already knows about this terminal. for (const terminalRenderer of this._terminalRenderers) { - if (terminalRenderer._id === terminal._id) { + if (terminalRenderer._id === id) { return terminalRenderer; } } - const dimensions = await this._proxy.$terminalGetDimensions(terminal._id); + const dimensions = await this._proxy.$terminalGetDimensions(id); + const terminal = this._getTerminalById(id); const renderer = new ExtHostTerminalRenderer(this._proxy, terminal.name, terminal, terminal._id, dimensions.cols, dimensions.rows); this._terminalRenderers.push(renderer); @@ -415,31 +413,18 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape { } } - public $acceptTerminalOpened(id: number, name: string, isRendererOnly: boolean, cols: number, rows: number): void { - let index = this._getTerminalObjectIndexById(this._terminals, id); + public $acceptTerminalOpened(id: number, name: string): void { + const index = this._getTerminalObjectIndexById(this._terminals, id); if (index !== null) { + // The terminal has already been created (via createTerminal*), only fire the event this._onDidOpenTerminal.fire(this.terminals[index]); - } - - let renderer = this._getTerminalRendererById(id); - - // If this is a terminal created by one of the public createTerminal* APIs - // then @acceptTerminalOpened was called from the main thread task - // to indicate that the terminal is ready for use. - // In those cases, we don't need to create the extension host objects - // as they already exist, but, we do still need to fire the events - // to our consumers. - if ((renderer !== null) && (index !== null)) { return; } - // The extension host did not know about this terminal, so create extension host - // objects to represent them. - if (!index) { - const terminal = new ExtHostTerminal(this._proxy, name, id, renderer ? RENDERER_NO_PROCESS_ID : undefined); - index = this._terminals.push(terminal); - this._onDidOpenTerminal.fire(terminal); - } + const renderer = this._getTerminalRendererById(id); + const terminal = new ExtHostTerminal(this._proxy, name, id, renderer ? RENDERER_NO_PROCESS_ID : undefined); + this._terminals.push(terminal); + this._onDidOpenTerminal.fire(terminal); } public $acceptTerminalProcessId(id: number, processId: number): void { diff --git a/src/vs/workbench/api/node/extHostTypes.ts b/src/vs/workbench/api/node/extHostTypes.ts index 6645557f4d0..50b5cd8b7cf 100644 --- a/src/vs/workbench/api/node/extHostTypes.ts +++ b/src/vs/workbench/api/node/extHostTypes.ts @@ -1708,7 +1708,7 @@ export enum TaskScope { Workspace = 2 } -export class CustomTaskExecution implements vscode.CustomTaskExecution { +export class CustomExecution implements vscode.CustomExecution { private _callback: (args: vscode.TerminalRenderer, cancellationToken: vscode.CancellationToken) => Thenable; constructor(callback: (args: vscode.TerminalRenderer, cancellationToken: vscode.CancellationToken) => Thenable) { @@ -1717,7 +1717,7 @@ export class CustomTaskExecution implements vscode.CustomTaskExecution { public computeId(): string { const hash = crypto.createHash('md5'); - hash.update('customTaskExecution'); + hash.update('customExecution'); hash.update(generateUuid()); return hash.digest('hex'); } @@ -1732,9 +1732,9 @@ export class CustomTaskExecution implements vscode.CustomTaskExecution { } @es5ClassCompat -export class Task implements vscode.TaskWithCustomTaskExecution { +export class Task implements vscode.Task2 { - private static ExtensionCallbackType: string = 'customTaskExecution'; + private static ExtensionCallbackType: string = 'customExecution'; private static ProcessType: string = 'process'; private static ShellType: string = 'shell'; private static EmptyType: string = '$empty'; @@ -1744,7 +1744,7 @@ export class Task implements vscode.TaskWithCustomTaskExecution { private _definition: vscode.TaskDefinition; private _scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder | undefined; private _name: string; - private _execution: ProcessExecution | ShellExecution | CustomTaskExecution | undefined; + private _execution: ProcessExecution | ShellExecution | CustomExecution | undefined; private _problemMatchers: string[]; private _hasDefinedMatchers: boolean; private _isBackground: boolean; @@ -1753,8 +1753,8 @@ export class Task implements vscode.TaskWithCustomTaskExecution { private _presentationOptions: vscode.TaskPresentationOptions; private _runOptions: vscode.RunOptions; - constructor(definition: vscode.TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomTaskExecution, problemMatchers?: string | string[]); - constructor(definition: vscode.TaskDefinition, scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomTaskExecution, problemMatchers?: string | string[]); + constructor(definition: vscode.TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution, problemMatchers?: string | string[]); + constructor(definition: vscode.TaskDefinition, scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution, 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[]; @@ -1819,7 +1819,7 @@ export class Task implements vscode.TaskWithCustomTaskExecution { type: Task.ShellType, id: this._execution.computeId() }; - } else if (this._execution instanceof CustomTaskExecution) { + } else if (this._execution instanceof CustomExecution) { this._definition = { type: Task.ExtensionCallbackType, id: this._execution.computeId() @@ -1866,18 +1866,18 @@ export class Task implements vscode.TaskWithCustomTaskExecution { } get execution(): ProcessExecution | ShellExecution | undefined { - return (this._execution instanceof CustomTaskExecution) ? undefined : this._execution; + return (this._execution instanceof CustomExecution) ? undefined : this._execution; } set execution(value: ProcessExecution | ShellExecution | undefined) { - this.executionWithExtensionCallback = value; + this.execution2 = value; } - get executionWithExtensionCallback(): ProcessExecution | ShellExecution | CustomTaskExecution | undefined { + get execution2(): ProcessExecution | ShellExecution | CustomExecution | undefined { return this._execution; } - set executionWithExtensionCallback(value: ProcessExecution | ShellExecution | CustomTaskExecution | undefined) { + set execution2(value: ProcessExecution | ShellExecution | CustomExecution | undefined) { if (value === null) { value = undefined; } diff --git a/src/vs/workbench/api/shared/tasks.ts b/src/vs/workbench/api/shared/tasks.ts index 2ee360a1cdd..0abf582d133 100644 --- a/src/vs/workbench/api/shared/tasks.ts +++ b/src/vs/workbench/api/shared/tasks.ts @@ -66,8 +66,8 @@ export interface ShellExecutionDTO { options?: ShellExecutionOptionsDTO; } -export interface CustomTaskExecutionDTO { - customTaskExecution: 'customTaskExecution'; +export interface CustomExecutionDTO { + customExecution: 'customExecution'; } export interface TaskSourceDTO { @@ -84,7 +84,7 @@ export interface TaskHandleDTO { export interface TaskDTO { _id: string; name?: string; - execution: ProcessExecutionDTO | ShellExecutionDTO | CustomTaskExecutionDTO; + execution: ProcessExecutionDTO | ShellExecutionDTO | CustomExecutionDTO; definition: TaskDefinitionDTO; isBackground?: boolean; source: TaskSourceDTO; diff --git a/src/vs/workbench/contrib/tasks/common/taskSystem.ts b/src/vs/workbench/contrib/tasks/common/taskSystem.ts index d2f6f1de695..56e9f05b226 100644 --- a/src/vs/workbench/contrib/tasks/common/taskSystem.ts +++ b/src/vs/workbench/contrib/tasks/common/taskSystem.ts @@ -136,5 +136,5 @@ export interface ITaskSystem { terminate(task: Task): Promise; terminateAll(): Promise; revealTask(task: Task): boolean; - customTaskExecutionComplete(task: Task, result: number | undefined): Promise; + customExecutionComplete(task: Task, result: number | undefined): Promise; } \ No newline at end of file diff --git a/src/vs/workbench/contrib/tasks/common/tasks.ts b/src/vs/workbench/contrib/tasks/common/tasks.ts index d5937a9f1f9..e1391a4a6b4 100644 --- a/src/vs/workbench/contrib/tasks/common/tasks.ts +++ b/src/vs/workbench/contrib/tasks/common/tasks.ts @@ -230,7 +230,7 @@ export namespace PresentationOptions { export enum RuntimeType { Shell = 1, Process = 2, - CustomTaskExecution = 3 + CustomExecution = 3 } export namespace RuntimeType { @@ -240,8 +240,8 @@ export namespace RuntimeType { return RuntimeType.Shell; case 'process': return RuntimeType.Process; - case 'customTaskExecution': - return RuntimeType.CustomTaskExecution; + case 'customExecution': + return RuntimeType.CustomExecution; default: return RuntimeType.Process; } @@ -607,8 +607,8 @@ export class CustomTask extends CommonTask { type = 'process'; break; - case RuntimeType.CustomTaskExecution: - type = 'customTaskExecution'; + case RuntimeType.CustomExecution: + type = 'customExecution'; break; default: diff --git a/src/vs/workbench/contrib/tasks/electron-browser/task.contribution.ts b/src/vs/workbench/contrib/tasks/electron-browser/task.contribution.ts index 6f53b37fa6b..c9ecfd45b90 100644 --- a/src/vs/workbench/contrib/tasks/electron-browser/task.contribution.ts +++ b/src/vs/workbench/contrib/tasks/electron-browser/task.contribution.ts @@ -722,7 +722,7 @@ class TaskService extends Disposable implements ITaskService { if (!this._taskSystem) { return Promise.resolve(); } - return this._taskSystem.customTaskExecutionComplete(task, result); + return this._taskSystem.customExecutionComplete(task, result); } public getTask(folder: IWorkspaceFolder | string, identifier: string | TaskIdentifier, compareId: boolean = false): Promise { diff --git a/src/vs/workbench/contrib/tasks/electron-browser/terminalTaskSystem.ts b/src/vs/workbench/contrib/tasks/electron-browser/terminalTaskSystem.ts index 531d01d5fd0..e67d7e57eb8 100644 --- a/src/vs/workbench/contrib/tasks/electron-browser/terminalTaskSystem.ts +++ b/src/vs/workbench/contrib/tasks/electron-browser/terminalTaskSystem.ts @@ -265,7 +265,7 @@ export class TerminalTaskSystem implements ITaskSystem { return Object.keys(this.activeTasks).map(key => this.activeTasks[key].task); } - public customTaskExecutionComplete(task: Task, result?: number): Promise { + public customExecutionComplete(task: Task, result?: number): Promise { let activeTerminal = this.activeTasks[task.getMapKey()]; if (!activeTerminal) { return Promise.reject(new Error('Expected to have a terminal for an custom execution task')); @@ -549,7 +549,7 @@ export class TerminalTaskSystem implements ITaskSystem { let processStartedSignaled = false; terminal.processReady.then(() => { if (!processStartedSignaled) { - if (task.command.runtime !== RuntimeType.CustomTaskExecution) { + if (task.command.runtime !== RuntimeType.CustomExecution) { this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.ProcessStarted, task, terminal!.processId!)); } processStartedSignaled = true; @@ -621,7 +621,7 @@ export class TerminalTaskSystem implements ITaskSystem { let processStartedSignaled = false; terminal.processReady.then(() => { if (!processStartedSignaled) { - if (task.command.runtime !== RuntimeType.CustomTaskExecution) { + if (task.command.runtime !== RuntimeType.CustomExecution) { this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.ProcessStarted, task, terminal!.processId!)); } processStartedSignaled = true; @@ -825,7 +825,7 @@ export class TerminalTaskSystem implements ITaskSystem { } } } else { - let commandExecutable = task.command.runtime !== RuntimeType.CustomTaskExecution ? CommandString.value(command) : undefined; + let commandExecutable = task.command.runtime !== RuntimeType.CustomExecution ? CommandString.value(command) : undefined; let executable = !isShellCommand ? this.resolveVariable(variableResolver, '${' + TerminalTaskSystem.ProcessVarName + '}') : commandExecutable; @@ -896,7 +896,7 @@ export class TerminalTaskSystem implements ITaskSystem { let command: CommandString | undefined; let args: CommandString[] | undefined; - if (task.command.runtime === RuntimeType.CustomTaskExecution) { + if (task.command.runtime === RuntimeType.CustomExecution) { this.currentTask.shellLaunchConfig = { isRendererOnly: true, waitOnExit, @@ -1116,7 +1116,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.CustomTaskExecution) { + if (command.runtime === RuntimeType.CustomExecution) { return; } diff --git a/src/vs/workbench/contrib/tasks/node/processTaskSystem.ts b/src/vs/workbench/contrib/tasks/node/processTaskSystem.ts index e12684b46fb..6117f7ff292 100644 --- a/src/vs/workbench/contrib/tasks/node/processTaskSystem.ts +++ b/src/vs/workbench/contrib/tasks/node/processTaskSystem.ts @@ -105,7 +105,7 @@ export class ProcessTaskSystem implements ITaskSystem { return true; } - public customTaskExecutionComplete(task: Task, result?: number): Promise { + public customExecutionComplete(task: Task, result?: number): Promise { throw new TaskError(Severity.Error, 'Custom execution task completion is never expected in the process task system.', TaskErrors.UnknownError); }