@@ -22,7 +22,7 @@ import { CLIServerBase, ICommandsExecuter } from 'vs/workbench/api/node/extHostC
22
22
import { IEnvironmentVariableCollection } from 'vs/platform/terminal/common/environmentVariable' ;
23
23
import { MergedEnvironmentVariableCollection } from 'vs/platform/terminal/common/environmentVariableCollection' ;
24
24
import { deserializeEnvironmentDescriptionMap , deserializeEnvironmentVariableCollection } from 'vs/platform/terminal/common/environmentVariableShared' ;
25
- import { ICreateTerminalProcessArguments , ICreateTerminalProcessResult , IWorkspaceFolderData } from 'vs/workbench/contrib/terminal/common/remoteTerminalChannel ' ;
25
+ import { ICreateTerminalProcessArguments , ICreateTerminalProcessResult , IWorkspaceFolderData , RemoteTerminalChannelEvent , RemoteTerminalChannelRequest } from 'vs/workbench/contrib/terminal/common/remote/terminal ' ;
26
26
import * as terminalEnvironment from 'vs/workbench/contrib/terminal/common/terminalEnvironment' ;
27
27
import { AbstractVariableResolverService } from 'vs/workbench/services/configurationResolver/common/variableResolver' ;
28
28
import { buildUserEnvironment } from 'vs/server/node/extensionHostConnection' ;
@@ -105,79 +105,80 @@ export class RemoteTerminalChannel extends Disposable implements IServerChannel<
105
105
super ( ) ;
106
106
}
107
107
108
- async call ( ctx : RemoteAgentConnectionContext , command : string , args ?: any ) : Promise < any > {
108
+ async call ( ctx : RemoteAgentConnectionContext , command : RemoteTerminalChannelRequest , args ?: any ) : Promise < any > {
109
109
switch ( command ) {
110
- case '$restartPtyHost' : return this . _ptyHostService . restartPtyHost . apply ( this . _ptyHostService , args ) ;
110
+ case RemoteTerminalChannelRequest . RestartPtyHost : return this . _ptyHostService . restartPtyHost . apply ( this . _ptyHostService , args ) ;
111
111
112
- case '$createProcess' : {
112
+ case RemoteTerminalChannelRequest . CreateProcess : {
113
113
const uriTransformer = createURITransformer ( ctx . remoteAuthority ) ;
114
114
return this . _createProcess ( uriTransformer , < ICreateTerminalProcessArguments > args ) ;
115
115
}
116
- case '$attachToProcess' : return this . _ptyHostService . attachToProcess . apply ( this . _ptyHostService , args ) ;
117
- case '$detachFromProcess' : return this . _ptyHostService . detachFromProcess . apply ( this . _ptyHostService , args ) ;
118
-
119
- case '$listProcesses' : return this . _ptyHostService . listProcesses . apply ( this . _ptyHostService , args ) ;
120
- case '$getPerformanceMarks' : return this . _ptyHostService . getPerformanceMarks . apply ( this . _ptyHostService , args ) ;
121
- case '$orphanQuestionReply' : return this . _ptyHostService . orphanQuestionReply . apply ( this . _ptyHostService , args ) ;
122
- case '$acceptPtyHostResolvedVariables' : return this . _ptyHostService . acceptPtyHostResolvedVariables . apply ( this . _ptyHostService , args ) ;
123
-
124
- case '$start' : return this . _ptyHostService . start . apply ( this . _ptyHostService , args ) ;
125
- case '$input' : return this . _ptyHostService . input . apply ( this . _ptyHostService , args ) ;
126
- case '$acknowledgeDataEvent' : return this . _ptyHostService . acknowledgeDataEvent . apply ( this . _ptyHostService , args ) ;
127
- case '$shutdown' : return this . _ptyHostService . shutdown . apply ( this . _ptyHostService , args ) ;
128
- case '$resize' : return this . _ptyHostService . resize . apply ( this . _ptyHostService , args ) ;
129
- case '$clearBuffer' : return this . _ptyHostService . clearBuffer . apply ( this . _ptyHostService , args ) ;
130
- case '$getInitialCwd' : return this . _ptyHostService . getInitialCwd . apply ( this . _ptyHostService , args ) ;
131
- case '$getCwd' : return this . _ptyHostService . getCwd . apply ( this . _ptyHostService , args ) ;
132
-
133
- case '$processBinary' : return this . _ptyHostService . processBinary . apply ( this . _ptyHostService , args ) ;
134
-
135
- case '$sendCommandResult' : return this . _sendCommandResult ( args [ 0 ] , args [ 1 ] , args [ 2 ] ) ;
136
- case '$installAutoReply' : return this . _ptyHostService . installAutoReply . apply ( this . _ptyHostService , args ) ;
137
- case '$uninstallAllAutoReplies' : return this . _ptyHostService . uninstallAllAutoReplies . apply ( this . _ptyHostService , args ) ;
138
- case '$getDefaultSystemShell' : return this . _getDefaultSystemShell . apply ( this , args ) ;
139
- case '$getProfiles' : return this . _getProfiles . apply ( this , args ) ;
140
- case '$getEnvironment' : return this . _getEnvironment ( ) ;
141
- case '$getWslPath' : return this . _getWslPath ( args [ 0 ] , args [ 1 ] ) ;
142
- case '$getTerminalLayoutInfo' : return this . _ptyHostService . getTerminalLayoutInfo ( < IGetTerminalLayoutInfoArgs > args ) ;
143
- case '$setTerminalLayoutInfo' : return this . _ptyHostService . setTerminalLayoutInfo ( < ISetTerminalLayoutInfoArgs > args ) ;
144
- case '$serializeTerminalState' : return this . _ptyHostService . serializeTerminalState . apply ( this . _ptyHostService , args ) ;
145
- case '$reviveTerminalProcesses' : return this . _ptyHostService . reviveTerminalProcesses . apply ( this . _ptyHostService , args ) ;
146
- case '$getRevivedPtyNewId' : return this . _ptyHostService . getRevivedPtyNewId . apply ( this . _ptyHostService , args ) ;
147
- case '$setUnicodeVersion' : return this . _ptyHostService . setUnicodeVersion . apply ( this . _ptyHostService , args ) ;
148
- case '$reduceConnectionGraceTime' : return this . _reduceConnectionGraceTime ( ) ;
149
- case '$updateIcon' : return this . _ptyHostService . updateIcon . apply ( this . _ptyHostService , args ) ;
150
- case '$updateTitle' : return this . _ptyHostService . updateTitle . apply ( this . _ptyHostService , args ) ;
151
- case '$updateProperty' : return this . _ptyHostService . updateProperty . apply ( this . _ptyHostService , args ) ;
152
- case '$refreshProperty' : return this . _ptyHostService . refreshProperty . apply ( this . _ptyHostService , args ) ;
153
- case '$requestDetachInstance' : return this . _ptyHostService . requestDetachInstance ( args [ 0 ] , args [ 1 ] ) ;
154
- case '$acceptDetachedInstance' : return this . _ptyHostService . acceptDetachInstanceReply ( args [ 0 ] , args [ 1 ] ) ;
155
- case '$freePortKillProcess' : return this . _ptyHostService . freePortKillProcess . apply ( this . _ptyHostService , args ) ;
116
+ case RemoteTerminalChannelRequest . AttachToProcess : return this . _ptyHostService . attachToProcess . apply ( this . _ptyHostService , args ) ;
117
+ case RemoteTerminalChannelRequest . DetachFromProcess : return this . _ptyHostService . detachFromProcess . apply ( this . _ptyHostService , args ) ;
118
+
119
+ case RemoteTerminalChannelRequest . ListProcesses : return this . _ptyHostService . listProcesses . apply ( this . _ptyHostService , args ) ;
120
+ case RemoteTerminalChannelRequest . GetPerformanceMarks : return this . _ptyHostService . getPerformanceMarks . apply ( this . _ptyHostService , args ) ;
121
+ case RemoteTerminalChannelRequest . OrphanQuestionReply : return this . _ptyHostService . orphanQuestionReply . apply ( this . _ptyHostService , args ) ;
122
+ case RemoteTerminalChannelRequest . AcceptPtyHostResolvedVariables : return this . _ptyHostService . acceptPtyHostResolvedVariables . apply ( this . _ptyHostService , args ) ;
123
+
124
+ case RemoteTerminalChannelRequest . Start : return this . _ptyHostService . start . apply ( this . _ptyHostService , args ) ;
125
+ case RemoteTerminalChannelRequest . Input : return this . _ptyHostService . input . apply ( this . _ptyHostService , args ) ;
126
+ case RemoteTerminalChannelRequest . AcknowledgeDataEvent : return this . _ptyHostService . acknowledgeDataEvent . apply ( this . _ptyHostService , args ) ;
127
+ case RemoteTerminalChannelRequest . Shutdown : return this . _ptyHostService . shutdown . apply ( this . _ptyHostService , args ) ;
128
+ case RemoteTerminalChannelRequest . Resize : return this . _ptyHostService . resize . apply ( this . _ptyHostService , args ) ;
129
+ case RemoteTerminalChannelRequest . ClearBuffer : return this . _ptyHostService . clearBuffer . apply ( this . _ptyHostService , args ) ;
130
+ case RemoteTerminalChannelRequest . GetInitialCwd : return this . _ptyHostService . getInitialCwd . apply ( this . _ptyHostService , args ) ;
131
+ case RemoteTerminalChannelRequest . GetCwd : return this . _ptyHostService . getCwd . apply ( this . _ptyHostService , args ) ;
132
+
133
+ case RemoteTerminalChannelRequest . ProcessBinary : return this . _ptyHostService . processBinary . apply ( this . _ptyHostService , args ) ;
134
+
135
+ case RemoteTerminalChannelRequest . SendCommandResult : return this . _sendCommandResult ( args [ 0 ] , args [ 1 ] , args [ 2 ] ) ;
136
+ case RemoteTerminalChannelRequest . InstallAutoReply : return this . _ptyHostService . installAutoReply . apply ( this . _ptyHostService , args ) ;
137
+ case RemoteTerminalChannelRequest . UninstallAllAutoReplies : return this . _ptyHostService . uninstallAllAutoReplies . apply ( this . _ptyHostService , args ) ;
138
+ case RemoteTerminalChannelRequest . GetDefaultSystemShell : return this . _getDefaultSystemShell . apply ( this , args ) ;
139
+ case RemoteTerminalChannelRequest . GetProfiles : return this . _getProfiles . apply ( this , args ) ;
140
+ case RemoteTerminalChannelRequest . GetEnvironment : return this . _getEnvironment ( ) ;
141
+ case RemoteTerminalChannelRequest . GetWslPath : return this . _getWslPath ( args [ 0 ] , args [ 1 ] ) ;
142
+ case RemoteTerminalChannelRequest . GetTerminalLayoutInfo : return this . _ptyHostService . getTerminalLayoutInfo ( < IGetTerminalLayoutInfoArgs > args ) ;
143
+ case RemoteTerminalChannelRequest . SetTerminalLayoutInfo : return this . _ptyHostService . setTerminalLayoutInfo ( < ISetTerminalLayoutInfoArgs > args ) ;
144
+ case RemoteTerminalChannelRequest . SerializeTerminalState : return this . _ptyHostService . serializeTerminalState . apply ( this . _ptyHostService , args ) ;
145
+ case RemoteTerminalChannelRequest . ReviveTerminalProcesses : return this . _ptyHostService . reviveTerminalProcesses . apply ( this . _ptyHostService , args ) ;
146
+ case RemoteTerminalChannelRequest . GetRevivedPtyNewId : return this . _ptyHostService . getRevivedPtyNewId . apply ( this . _ptyHostService , args ) ;
147
+ case RemoteTerminalChannelRequest . SetUnicodeVersion : return this . _ptyHostService . setUnicodeVersion . apply ( this . _ptyHostService , args ) ;
148
+ case RemoteTerminalChannelRequest . ReduceConnectionGraceTime : return this . _reduceConnectionGraceTime ( ) ;
149
+ case RemoteTerminalChannelRequest . UpdateIcon : return this . _ptyHostService . updateIcon . apply ( this . _ptyHostService , args ) ;
150
+ case RemoteTerminalChannelRequest . UpdateTitle : return this . _ptyHostService . updateTitle . apply ( this . _ptyHostService , args ) ;
151
+ case RemoteTerminalChannelRequest . UpdateProperty : return this . _ptyHostService . updateProperty . apply ( this . _ptyHostService , args ) ;
152
+ case RemoteTerminalChannelRequest . RefreshProperty : return this . _ptyHostService . refreshProperty . apply ( this . _ptyHostService , args ) ;
153
+ case RemoteTerminalChannelRequest . RequestDetachInstance : return this . _ptyHostService . requestDetachInstance ( args [ 0 ] , args [ 1 ] ) ;
154
+ case RemoteTerminalChannelRequest . AcceptDetachedInstance : return this . _ptyHostService . acceptDetachInstanceReply ( args [ 0 ] , args [ 1 ] ) ;
155
+ case RemoteTerminalChannelRequest . FreePortKillProcess : return this . _ptyHostService . freePortKillProcess . apply ( this . _ptyHostService , args ) ;
156
+ case RemoteTerminalChannelRequest . AcceptDetachInstanceReply : return this . _ptyHostService . acceptDetachInstanceReply . apply ( this . _ptyHostService , args ) ;
156
157
}
157
158
159
+ // @ts -expect-error Assert command is the `never` type to ensure all messages are handled
158
160
throw new Error ( `IPC Command ${ command } not found` ) ;
159
161
}
160
162
161
- listen ( _ : any , event : string , arg : any ) : Event < any > {
163
+ listen ( _ : any , event : RemoteTerminalChannelEvent , arg : any ) : Event < any > {
162
164
switch ( event ) {
163
- case '$onPtyHostExitEvent' : return this . _ptyHostService . onPtyHostExit || Event . None ;
164
- case '$onPtyHostStartEvent' : return this . _ptyHostService . onPtyHostStart || Event . None ;
165
- case '$onPtyHostUnresponsiveEvent' : return this . _ptyHostService . onPtyHostUnresponsive || Event . None ;
166
- case '$onPtyHostResponsiveEvent' : return this . _ptyHostService . onPtyHostResponsive || Event . None ;
167
- case '$onPtyHostRequestResolveVariablesEvent' : return this . _ptyHostService . onPtyHostRequestResolveVariables || Event . None ;
168
- case '$onProcessDataEvent' : return this . _ptyHostService . onProcessData ;
169
- case '$onProcessReadyEvent' : return this . _ptyHostService . onProcessReady ;
170
- case '$onProcessExitEvent' : return this . _ptyHostService . onProcessExit ;
171
- case '$onProcessReplayEvent' : return this . _ptyHostService . onProcessReplay ;
172
- case '$onProcessOrphanQuestion' : return this . _ptyHostService . onProcessOrphanQuestion ;
173
- case '$onExecuteCommand' : return this . onExecuteCommand ;
174
- case '$onDidRequestDetach' : return this . _ptyHostService . onDidRequestDetach || Event . None ;
175
- case '$onDidChangeProperty' : return this . _ptyHostService . onDidChangeProperty ;
176
- default :
177
- break ;
165
+ case RemoteTerminalChannelEvent . OnPtyHostExitEvent : return this . _ptyHostService . onPtyHostExit || Event . None ;
166
+ case RemoteTerminalChannelEvent . OnPtyHostStartEvent : return this . _ptyHostService . onPtyHostStart || Event . None ;
167
+ case RemoteTerminalChannelEvent . OnPtyHostUnresponsiveEvent : return this . _ptyHostService . onPtyHostUnresponsive || Event . None ;
168
+ case RemoteTerminalChannelEvent . OnPtyHostResponsiveEvent : return this . _ptyHostService . onPtyHostResponsive || Event . None ;
169
+ case RemoteTerminalChannelEvent . OnPtyHostRequestResolveVariablesEvent : return this . _ptyHostService . onPtyHostRequestResolveVariables || Event . None ;
170
+ case RemoteTerminalChannelEvent . OnProcessDataEvent : return this . _ptyHostService . onProcessData ;
171
+ case RemoteTerminalChannelEvent . OnProcessReadyEvent : return this . _ptyHostService . onProcessReady ;
172
+ case RemoteTerminalChannelEvent . OnProcessExitEvent : return this . _ptyHostService . onProcessExit ;
173
+ case RemoteTerminalChannelEvent . OnProcessReplayEvent : return this . _ptyHostService . onProcessReplay ;
174
+ case RemoteTerminalChannelEvent . OnProcessOrphanQuestion : return this . _ptyHostService . onProcessOrphanQuestion ;
175
+ case RemoteTerminalChannelEvent . OnExecuteCommand : return this . onExecuteCommand ;
176
+ case RemoteTerminalChannelEvent . OnDidRequestDetach : return this . _ptyHostService . onDidRequestDetach || Event . None ;
177
+ case RemoteTerminalChannelEvent . OnDidChangeProperty : return this . _ptyHostService . onDidChangeProperty ;
178
178
}
179
179
180
- throw new Error ( 'Not supported' ) ;
180
+ // @ts -expect-error Assert event is the `never` type to ensure all messages are handled
181
+ throw new Error ( `IPC Command ${ event } not found` ) ;
181
182
}
182
183
183
184
private async _createProcess ( uriTransformer : IURITransformer , args : ICreateTerminalProcessArguments ) : Promise < ICreateTerminalProcessResult > {
0 commit comments