@@ -22,7 +22,7 @@ import {
2222 TaskDefinitionDTO , TaskExecutionDTO , TaskPresentationOptionsDTO ,
2323 ProcessExecutionOptionsDTO , ProcessExecutionDTO ,
2424 ShellExecutionOptionsDTO , ShellExecutionDTO ,
25- CustomTaskExecutionDTO ,
25+ CustomExecutionDTO ,
2626 TaskDTO , TaskHandleDTO , TaskFilterDTO , TaskProcessStartedDTO , TaskProcessEndedDTO , TaskSystemInfoDTO , TaskSetDTO
2727} from '../shared/tasks' ;
2828import { ExtHostVariableResolverService } from 'vs/workbench/api/node/extHostDebugService' ;
@@ -79,7 +79,7 @@ namespace ProcessExecutionOptionsDTO {
7979}
8080
8181namespace ProcessExecutionDTO {
82- export function is ( value : ShellExecutionDTO | ProcessExecutionDTO | CustomTaskExecutionDTO ) : value is ProcessExecutionDTO {
82+ export function is ( value : ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO ) : value is ProcessExecutionDTO {
8383 let candidate = value as ProcessExecutionDTO ;
8484 return candidate && ! ! candidate . process ;
8585 }
@@ -120,7 +120,7 @@ namespace ShellExecutionOptionsDTO {
120120}
121121
122122namespace ShellExecutionDTO {
123- export function is ( value : ShellExecutionDTO | ProcessExecutionDTO | CustomTaskExecutionDTO ) : value is ShellExecutionDTO {
123+ export function is ( value : ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO ) : value is ShellExecutionDTO {
124124 let candidate = value as ShellExecutionDTO ;
125125 return candidate && ( ! ! candidate . commandLine || ! ! candidate . command ) ;
126126 }
@@ -153,15 +153,15 @@ namespace ShellExecutionDTO {
153153 }
154154}
155155
156- namespace CustomTaskExecutionDTO {
157- export function is ( value : ShellExecutionDTO | ProcessExecutionDTO | CustomTaskExecutionDTO ) : value is CustomTaskExecutionDTO {
158- let candidate = value as CustomTaskExecutionDTO ;
159- return candidate && candidate . customTaskExecution === 'customTaskExecution ' ;
156+ namespace CustomExecutionDTO {
157+ export function is ( value : ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO ) : value is CustomExecutionDTO {
158+ let candidate = value as CustomExecutionDTO ;
159+ return candidate && candidate . customExecution === 'customExecution ' ;
160160 }
161161
162- export function from ( value : vscode . CustomTaskExecution ) : CustomTaskExecutionDTO {
162+ export function from ( value : vscode . CustomExecution ) : CustomExecutionDTO {
163163 return {
164- customTaskExecution : 'customTaskExecution '
164+ customExecution : 'customExecution '
165165 } ;
166166 }
167167}
@@ -199,13 +199,13 @@ namespace TaskDTO {
199199 if ( value === undefined || value === null ) {
200200 return undefined ;
201201 }
202- let execution : ShellExecutionDTO | ProcessExecutionDTO | CustomTaskExecutionDTO ;
202+ let execution : ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO ;
203203 if ( value . execution instanceof types . ProcessExecution ) {
204204 execution = ProcessExecutionDTO . from ( value . execution ) ;
205205 } else if ( value . execution instanceof types . ShellExecution ) {
206206 execution = ShellExecutionDTO . from ( value . execution ) ;
207- } else if ( ( < vscode . TaskWithCustomTaskExecution > value ) . executionWithExtensionCallback && ( < vscode . TaskWithCustomTaskExecution > value ) . executionWithExtensionCallback instanceof types . CustomTaskExecution ) {
208- execution = CustomTaskExecutionDTO . from ( < types . CustomTaskExecution > ( < vscode . TaskWithCustomTaskExecution > value ) . executionWithExtensionCallback ) ;
207+ } else if ( ( < vscode . Task2 > value ) . execution2 && ( < vscode . Task2 > value ) . execution2 instanceof types . CustomExecution ) {
208+ execution = CustomExecutionDTO . from ( < types . CustomExecution > ( < vscode . Task2 > value ) . execution2 ) ;
209209 }
210210
211211 let definition : TaskDefinitionDTO = TaskDefinitionDTO . from ( value . definition ) ;
@@ -336,24 +336,24 @@ interface HandlerData {
336336 extension : IExtensionDescription ;
337337}
338338
339- class CustomTaskExecutionData implements IDisposable {
339+ class CustomExecutionData implements IDisposable {
340340 private _cancellationSource ?: CancellationTokenSource ;
341- private readonly _onTaskExecutionComplete : Emitter < CustomTaskExecutionData > = new Emitter < CustomTaskExecutionData > ( ) ;
341+ private readonly _onTaskExecutionComplete : Emitter < CustomExecutionData > = new Emitter < CustomExecutionData > ( ) ;
342342 private readonly _disposables : IDisposable [ ] = [ ] ;
343343 private terminal ?: vscode . Terminal ;
344344 private terminalId ?: number ;
345345 public result : number | undefined ;
346346
347347 constructor (
348- private readonly callbackData : vscode . CustomTaskExecution ,
348+ private readonly callbackData : vscode . CustomExecution ,
349349 private readonly terminalService : ExtHostTerminalService ) {
350350 }
351351
352352 public dispose ( ) : void {
353353 dispose ( this . _disposables ) ;
354354 }
355355
356- public get onTaskExecutionComplete ( ) : Event < CustomTaskExecutionData > {
356+ public get onTaskExecutionComplete ( ) : Event < CustomExecutionData > {
357357 return this . _onTaskExecutionComplete . event ;
358358 }
359359
@@ -396,7 +396,7 @@ class CustomTaskExecutionData implements IDisposable {
396396 }
397397
398398 this . terminal = callbackTerminals [ 0 ] ;
399- const terminalRenderer : vscode . TerminalRenderer = await this . terminalService . createTerminalRendererForTerminal ( this . terminal ) ;
399+ const terminalRenderer : vscode . TerminalRenderer = await this . terminalService . resolveTerminalRenderer ( terminalId ) ;
400400
401401 this . _cancellationSource = new CancellationTokenSource ( ) ;
402402 this . _disposables . push ( this . _cancellationSource ) ;
@@ -424,8 +424,8 @@ export class ExtHostTask implements ExtHostTaskShape {
424424 private _handleCounter : number ;
425425 private _handlers : Map < number , HandlerData > ;
426426 private _taskExecutions : Map < string , TaskExecutionImpl > ;
427- private _providedCustomTaskExecutions : Map < string , CustomTaskExecutionData > ;
428- private _activeCustomTaskExecutions : Map < string , CustomTaskExecutionData > ;
427+ private _providedCustomExecutions : Map < string , CustomExecutionData > ;
428+ private _activeCustomExecutions : Map < string , CustomExecutionData > ;
429429
430430 private readonly _onDidExecuteTask : Emitter < vscode . TaskStartEvent > = new Emitter < vscode . TaskStartEvent > ( ) ;
431431 private readonly _onDidTerminateTask : Emitter < vscode . TaskEndEvent > = new Emitter < vscode . TaskEndEvent > ( ) ;
@@ -447,8 +447,8 @@ export class ExtHostTask implements ExtHostTaskShape {
447447 this . _handleCounter = 0 ;
448448 this . _handlers = new Map < number , HandlerData > ( ) ;
449449 this . _taskExecutions = new Map < string , TaskExecutionImpl > ( ) ;
450- this . _providedCustomTaskExecutions = new Map < string , CustomTaskExecutionData > ( ) ;
451- this . _activeCustomTaskExecutions = new Map < string , CustomTaskExecutionData > ( ) ;
450+ this . _providedCustomExecutions = new Map < string , CustomExecutionData > ( ) ;
451+ this . _activeCustomExecutions = new Map < string , CustomExecutionData > ( ) ;
452452 }
453453
454454 public registerTaskProvider ( extension : IExtensionDescription , provider : vscode . TaskProvider ) : vscode . Disposable {
@@ -518,16 +518,16 @@ export class ExtHostTask implements ExtHostTaskShape {
518518 // Once a terminal is spun up for the custom execution task this event will be fired.
519519 // At that point, we need to actually start the callback, but
520520 // only if it hasn't already begun.
521- const extensionCallback : CustomTaskExecutionData | undefined = this . _providedCustomTaskExecutions . get ( execution . id ) ;
521+ const extensionCallback : CustomExecutionData | undefined = this . _providedCustomExecutions . get ( execution . id ) ;
522522 if ( extensionCallback ) {
523- if ( this . _activeCustomTaskExecutions . get ( execution . id ) !== undefined ) {
523+ if ( this . _activeCustomExecutions . get ( execution . id ) !== undefined ) {
524524 throw new Error ( 'We should not be trying to start the same custom task executions twice.' ) ;
525525 }
526526
527- this . _activeCustomTaskExecutions . set ( execution . id , extensionCallback ) ;
527+ this . _activeCustomExecutions . set ( execution . id , extensionCallback ) ;
528528
529529 const taskExecutionComplete : IDisposable = extensionCallback . onTaskExecutionComplete ( ( ) => {
530- this . customTaskExecutionComplete ( execution ) ;
530+ this . customExecutionComplete ( execution ) ;
531531 taskExecutionComplete . dispose ( ) ;
532532 } ) ;
533533
@@ -548,7 +548,7 @@ export class ExtHostTask implements ExtHostTaskShape {
548548 const workspaceProvider = await this . _workspaceService . getWorkspaceProvider ( ) ;
549549 const _execution = this . getTaskExecution ( execution , workspaceProvider ) ;
550550 this . _taskExecutions . delete ( execution . id ) ;
551- this . customTaskExecutionComplete ( execution ) ;
551+ this . customExecutionComplete ( execution ) ;
552552 this . _onDidTerminateTask . fire ( {
553553 execution : _execution
554554 } ) ;
@@ -593,7 +593,7 @@ export class ExtHostTask implements ExtHostTaskShape {
593593 // For custom execution tasks, we need to store the execution objects locally
594594 // since we obviously cannot send callback functions through the proxy.
595595 // So, clear out any existing ones.
596- this . _providedCustomTaskExecutions . clear ( ) ;
596+ this . _providedCustomExecutions . clear ( ) ;
597597
598598 // Set up a list of task ID promises that we can wait on
599599 // before returning the provided tasks. The ensures that
@@ -614,13 +614,13 @@ export class ExtHostTask implements ExtHostTaskShape {
614614 const taskDTO : TaskDTO = TaskDTO . from ( task , handler . extension ) ;
615615 taskDTOs . push ( taskDTO ) ;
616616
617- if ( CustomTaskExecutionDTO . is ( taskDTO . execution ) ) {
617+ if ( CustomExecutionDTO . is ( taskDTO . execution ) ) {
618618 taskIdPromises . push ( new Promise ( ( resolve ) => {
619619 // The ID is calculated on the main thread task side, so, let's call into it here.
620620 // We need the task id's pre-computed for custom task executions because when OnDidStartTask
621621 // is invoked, we have to be able to map it back to our data.
622622 this . _proxy . $createTaskId ( taskDTO ) . then ( ( taskId ) => {
623- this . _providedCustomTaskExecutions . set ( taskId , new CustomTaskExecutionData ( < vscode . CustomTaskExecution > ( < vscode . TaskWithCustomTaskExecution > task ) . executionWithExtensionCallback , this . _terminalService ) ) ;
623+ this . _providedCustomExecutions . set ( taskId , new CustomExecutionData ( < vscode . CustomExecution > ( < vscode . Task2 > task ) . execution2 , this . _terminalService ) ) ;
624624 resolve ( ) ;
625625 } ) ;
626626 } ) ) ;
@@ -698,11 +698,11 @@ export class ExtHostTask implements ExtHostTaskShape {
698698 return result ;
699699 }
700700
701- private customTaskExecutionComplete ( execution : TaskExecutionDTO ) : void {
702- const extensionCallback : CustomTaskExecutionData | undefined = this . _activeCustomTaskExecutions . get ( execution . id ) ;
701+ private customExecutionComplete ( execution : TaskExecutionDTO ) : void {
702+ const extensionCallback : CustomExecutionData | undefined = this . _activeCustomExecutions . get ( execution . id ) ;
703703 if ( extensionCallback ) {
704- this . _activeCustomTaskExecutions . delete ( execution . id ) ;
705- this . _proxy . $customTaskExecutionComplete ( execution . id , extensionCallback . result ) ;
704+ this . _activeCustomExecutions . delete ( execution . id ) ;
705+ this . _proxy . $customExecutionComplete ( execution . id , extensionCallback . result ) ;
706706 extensionCallback . dispose ( ) ;
707707 }
708708 }
0 commit comments