@@ -33,7 +33,7 @@ import { TerminalDataBufferer } from 'vs/platform/terminal/common/terminalDataBu
33
33
import * as terminalEnvironment from 'vs/workbench/contrib/terminal/common/terminalEnvironment' ;
34
34
import { getMainProcessParentEnv } from 'vs/workbench/contrib/terminal/node/terminalEnvironment' ;
35
35
import { TerminalProcess } from 'vs/platform/terminal/node/terminalProcess' ;
36
- import { ISetTerminalLayoutInfoArgs , IGetTerminalLayoutInfoArgs } from 'vs/platform/terminal/common/terminalProcess' ;
36
+ import { ISetTerminalLayoutInfoArgs , IGetTerminalLayoutInfoArgs , IProcessDetails } from 'vs/platform/terminal/common/terminalProcess' ;
37
37
import { AbstractVariableResolverService } from 'vs/workbench/services/configurationResolver/common/variableResolver' ;
38
38
import { ExtensionScanner , ExtensionScannerInput } from 'vs/workbench/services/extensions/node/extensionPoints' ;
39
39
@@ -415,7 +415,7 @@ class Terminal {
415
415
private disposeDelay = 48 * 60 * 60 * 1000 ;
416
416
417
417
private buffering = false ;
418
- private readonly _onEvent = new Emitter < terminal . IRemoteTerminalProcessEvent > ( {
418
+ private readonly _onEvent = new Emitter < any > ( {
419
419
// Don't bind to data until something is listening.
420
420
onFirstListenerAdd : ( ) => {
421
421
logger . debug ( 'Terminal bound' , field ( 'id' , this . id ) ) ;
@@ -461,7 +461,7 @@ class Terminal {
461
461
}
462
462
} ) ;
463
463
464
- public get onEvent ( ) : Event < terminal . IRemoteTerminalProcessEvent > { return this . _onEvent . event ; }
464
+ public get onEvent ( ) : Event < any > { return this . _onEvent . event ; }
465
465
466
466
// Buffer to reduce the number of messages going to the renderer.
467
467
private readonly bufferer = new TerminalDataBufferer ( ( _ , data ) => {
@@ -624,7 +624,7 @@ class Terminal {
624
624
/**
625
625
* Serializable terminal information that can be sent to the client.
626
626
*/
627
- public async description ( id : number ) : Promise < terminal . IRemoteTerminalDescriptionDto > {
627
+ public async description ( id : number ) : Promise < IProcessDetails > {
628
628
const cwd = await this . getCwd ( ) ;
629
629
return {
630
630
id,
@@ -658,23 +658,22 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
658
658
throw new Error ( `Invalid listen '${ event } '` ) ;
659
659
}
660
660
661
- private onTerminalProcessEvent ( args : terminal . IOnTerminalProcessEventArguments ) : Event < terminal . IRemoteTerminalProcessEvent > {
662
- return this . getTerminal ( args . id ) . onEvent ;
661
+ private onTerminalProcessEvent ( id : number ) : Event < any > {
662
+ return this . getTerminal ( id ) . onEvent ;
663
663
}
664
664
665
665
public call ( context : RemoteAgentConnectionContext , command : string , args ?: any ) : Promise < any > {
666
666
switch ( command ) {
667
667
case '$createTerminalProcess' : return this . createTerminalProcess ( context . remoteAuthority , args ) ;
668
- case '$startTerminalProcess' : return this . startTerminalProcess ( args ) ;
669
- case '$sendInputToTerminalProcess' : return this . sendInputToTerminalProcess ( args ) ;
670
- case '$sendCharCountToTerminalProcess' : return this . sendCharCountToTerminalProcess ( args ) ;
671
- case '$shutdownTerminalProcess' : return this . shutdownTerminalProcess ( args ) ;
672
- case '$resizeTerminalProcess' : return this . resizeTerminalProcess ( args ) ;
673
- case '$getTerminalInitialCwd' : return this . getTerminalInitialCwd ( args ) ;
674
- case '$getTerminalCwd' : return this . getTerminalCwd ( args ) ;
675
- case '$sendCommandResultToTerminalProcess' : return this . sendCommandResultToTerminalProcess ( args ) ;
676
- case '$orphanQuestionReply' : return this . orphanQuestionReply ( args [ 0 ] ) ;
677
- case '$listTerminals' : return this . listTerminals ( args [ 0 ] ) ;
668
+ case '$startTerminalProcess' : return this . startTerminalProcess ( ...args as [ number ] ) ;
669
+ case '$sendInputToTerminalProcess' : return this . sendInputToTerminalProcess ( ...args as [ number , string ] ) ;
670
+ case '$sendCharCountToTerminalProcess' : return this . sendCharCountToTerminalProcess ( ...args as [ number , number ] ) ;
671
+ case '$shutdownTerminalProcess' : return this . shutdownTerminalProcess ( ...args as [ number , boolean ] ) ;
672
+ case '$resizeTerminalProcess' : return this . resizeTerminalProcess ( ...args as [ number , number , number ] ) ;
673
+ case '$getTerminalInitialCwd' : return this . getTerminalInitialCwd ( ...args as [ number ] ) ;
674
+ case '$getTerminalCwd' : return this . getTerminalCwd ( ...args as [ number ] ) ;
675
+ case '$sendCommandResultToTerminalProcess' : return this . sendCommandResultToTerminalProcess ( ...args as [ number , number , boolean , any ] ) ;
676
+ case '$orphanQuestionReply' : return this . orphanQuestionReply ( ...args as [ number ] ) ;
678
677
case '$setTerminalLayoutInfo' : return this . setTerminalLayoutInfo ( args ) ;
679
678
case '$getTerminalLayoutInfo' : return this . getTerminalLayoutInfo ( args ) ;
680
679
}
@@ -729,7 +728,7 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
729
728
const executable = terminalEnvironment . getDefaultShell (
730
729
( key ) => args . configuration [ key ] ,
731
730
args . isWorkspaceShellAllowed ,
732
- await getSystemShell ( platform . platform ) ,
731
+ await getSystemShell ( platform . platform , env ) ,
733
732
process . env . hasOwnProperty ( 'PROCESSOR_ARCHITEW6432' ) ,
734
733
process . env . windir ,
735
734
resolver ,
@@ -816,7 +815,7 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
816
815
terminal . onDispose ( ( ) => this . terminals . delete ( terminalId ) ) ;
817
816
818
817
return {
819
- terminalId,
818
+ persistentTerminalId : terminalId ,
820
819
resolvedShellLaunchConfig,
821
820
} ;
822
821
}
@@ -829,58 +828,44 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
829
828
return terminal ;
830
829
}
831
830
832
- private async startTerminalProcess ( args : terminal . IStartTerminalProcessArguments ) : Promise < ITerminalLaunchError | void > {
833
- return this . getTerminal ( args . id ) . start ( ) ;
831
+ private async startTerminalProcess ( id : number ) : Promise < ITerminalLaunchError | void > {
832
+ return this . getTerminal ( id ) . start ( ) ;
834
833
}
835
834
836
- private async sendInputToTerminalProcess ( args : terminal . ISendInputToTerminalProcessArguments ) : Promise < void > {
837
- return this . getTerminal ( args . id ) . input ( args . data ) ;
835
+ private async sendInputToTerminalProcess ( id : number , data : string ) : Promise < void > {
836
+ return this . getTerminal ( id ) . input ( data ) ;
838
837
}
839
838
840
- private async sendCharCountToTerminalProcess ( args : terminal . ISendCharCountToTerminalProcessArguments ) : Promise < void > {
841
- return this . getTerminal ( args . id ) . acknowledgeDataEvent ( args . charCount ) ;
839
+ private async sendCharCountToTerminalProcess ( id : number , charCount : number ) : Promise < void > {
840
+ return this . getTerminal ( id ) . acknowledgeDataEvent ( charCount ) ;
842
841
}
843
842
844
- private async shutdownTerminalProcess ( args : terminal . IShutdownTerminalProcessArguments ) : Promise < void > {
845
- return this . getTerminal ( args . id ) . shutdown ( args . immediate ) ;
843
+ private async shutdownTerminalProcess ( id : number , immediate : boolean ) : Promise < void > {
844
+ return this . getTerminal ( id ) . shutdown ( immediate ) ;
846
845
}
847
846
848
- private async resizeTerminalProcess ( args : terminal . IResizeTerminalProcessArguments ) : Promise < void > {
849
- return this . getTerminal ( args . id ) . resize ( args . cols , args . rows ) ;
847
+ private async resizeTerminalProcess ( id : number , cols : number , rows : number ) : Promise < void > {
848
+ return this . getTerminal ( id ) . resize ( cols , rows ) ;
850
849
}
851
850
852
- private async getTerminalInitialCwd ( args : terminal . IGetTerminalInitialCwdArguments ) : Promise < string > {
853
- return this . getTerminal ( args . id ) . getInitialCwd ( ) ;
851
+ private async getTerminalInitialCwd ( id : number ) : Promise < string > {
852
+ return this . getTerminal ( id ) . getInitialCwd ( ) ;
854
853
}
855
854
856
- private async getTerminalCwd ( args : terminal . IGetTerminalCwdArguments ) : Promise < string > {
857
- return this . getTerminal ( args . id ) . getCwd ( ) ;
855
+ private async getTerminalCwd ( id : number ) : Promise < string > {
856
+ return this . getTerminal ( id ) . getCwd ( ) ;
858
857
}
859
858
860
- private async sendCommandResultToTerminalProcess ( _ : terminal . ISendCommandResultToTerminalProcessArguments ) : Promise < void > {
859
+ private async sendCommandResultToTerminalProcess ( id : number , reqId : number , isError : boolean , payload : any ) : Promise < void > {
861
860
// NOTE: Not required unless we implement the `execCommand` event, see above.
862
861
throw new Error ( 'not implemented' ) ;
863
862
}
864
863
865
- private async orphanQuestionReply ( _ : terminal . IOrphanQuestionReplyArgs ) : Promise < void > {
864
+ private async orphanQuestionReply ( id : number ) : Promise < void > {
866
865
// NOTE: Not required unless we implement the `orphan?` event, see above.
867
866
throw new Error ( 'not implemented' ) ;
868
867
}
869
868
870
- private async listTerminals ( _ : terminal . IListTerminalsArgs ) : Promise < terminal . IRemoteTerminalDescriptionDto [ ] > {
871
- // TODO: args.isInitialization. Maybe this is to have slightly different
872
- // behavior when first listing terminals but I don't know what you'd want to
873
- // do differently. Maybe it's to reset the terminal dispose timeouts or
874
- // something like that, but why not do it each time you list?
875
- const terminals = await Promise . all ( Array . from ( this . terminals ) . map ( async ( [ id , terminal ] ) => {
876
- return terminal . description ( id ) ;
877
- } ) ) ;
878
-
879
- // Only returned orphaned terminals so we don't end up attaching to
880
- // terminals already attached elsewhere.
881
- return terminals . filter ( ( t ) => t . isOrphan ) ;
882
- }
883
-
884
869
public async setTerminalLayoutInfo ( args : ISetTerminalLayoutInfoArgs ) : Promise < void > {
885
870
this . layouts . set ( args . workspaceId , args ) ;
886
871
}
0 commit comments