@@ -7,7 +7,7 @@ import { Emitter } from 'vs/base/common/event';
7
7
import { Schemas } from 'vs/base/common/network' ;
8
8
import { URI } from 'vs/base/common/uri' ;
9
9
import { getMachineId } from 'vs/base/node/id' ;
10
- import { ClientConnectionEvent , createChannelReceiver , IPCServer , IServerChannel } from 'vs/base/parts/ipc/common/ipc' ;
10
+ import { ClientConnectionEvent , IPCServer , IServerChannel , ProxyChannel , StaticRouter } from 'vs/base/parts/ipc/common/ipc' ;
11
11
import { LogsDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner' ;
12
12
import { main } from 'vs/code/node/cliProcessMain' ;
13
13
import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
@@ -28,10 +28,10 @@ import { InstantiationService } from 'vs/platform/instantiation/common/instantia
28
28
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection' ;
29
29
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations' ;
30
30
import { LocalizationsService } from 'vs/platform/localizations/node/localizations' ;
31
- import { getLogLevel , ILoggerService , ILogService } from 'vs/platform/log/common/log' ;
32
- import { LoggerChannel } from 'vs/platform/log/common/logIpc' ;
31
+ import { ConsoleLogger , getLogLevel , ILoggerService , ILogService , MultiplexLogService } from 'vs/platform/log/common/log' ;
32
+ import { FollowerLogService , LoggerChannel , LoggerChannelClient } from 'vs/platform/log/common/logIpc' ;
33
33
import { LoggerService } from 'vs/platform/log/node/loggerService' ;
34
- import { SpdLogService } from 'vs/platform/log/node/spdlogService ' ;
34
+ import { SpdLogLogger } from 'vs/platform/log/node/spdlogLog ' ;
35
35
import product from 'vs/platform/product/common/product' ;
36
36
import { IProductService } from 'vs/platform/product/common/productService' ;
37
37
import { ConnectionType , ConnectionTypeRequest } from 'vs/platform/remote/common/remoteAgentConnection' ;
@@ -212,11 +212,27 @@ export class Vscode {
212
212
}
213
213
214
214
private async initializeServices ( args : NativeParsedArgs ) : Promise < void > {
215
+ /*
216
+ NOTE@coder: this initializeServices is loosely based off this file:
217
+ https://github.com/cdr/code-server/blob/main/lib/vscode/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts#L148
218
+
219
+ If upstream changes cause conflicts, look there ^.
220
+ */
215
221
const environmentService = new NativeEnvironmentService ( args ) ;
216
222
// https://github.com/cdr/code-server/issues/1693
217
223
fs . mkdirSync ( environmentService . globalStorageHome . fsPath , { recursive : true } ) ;
218
-
219
- const logService = new SpdLogService ( RemoteExtensionLogFileName , environmentService . logsPath , getLogLevel ( environmentService ) ) ;
224
+ /*
225
+ NOTE@coder: Made these updates on 3/11/21 by @jsjoeio
226
+ based on this file (and lines):
227
+ https://github.com/cdr/code-server/blob/main/lib/vscode/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts#L144-L149
228
+ */
229
+ const mainRouter = new StaticRouter ( ctx => ctx === 'main' )
230
+ const loggerClient = new LoggerChannelClient ( this . ipc . getChannel ( 'logger' , mainRouter ) )
231
+ const multiplexLogger = new MultiplexLogService ( [
232
+ new ConsoleLogger ( getLogLevel ( environmentService ) ) ,
233
+ new SpdLogLogger ( RemoteExtensionLogFileName , environmentService . logsPath , false , getLogLevel ( environmentService ) )
234
+ ] )
235
+ const logService = new FollowerLogService ( loggerClient , multiplexLogger )
220
236
const fileService = new FileService ( logService ) ;
221
237
fileService . registerProvider ( Schemas . file , new DiskFileSystemProvider ( logService ) ) ;
222
238
@@ -286,7 +302,15 @@ export class Vscode {
286
302
) ) ;
287
303
this . ipc . registerChannel ( 'request' , new RequestChannel ( accessor . get ( IRequestService ) ) ) ;
288
304
this . ipc . registerChannel ( 'telemetry' , new TelemetryChannel ( telemetryService ) ) ;
289
- this . ipc . registerChannel ( 'localizations' , < IServerChannel < any > > createChannelReceiver ( accessor . get ( ILocalizationsService ) ) ) ;
305
+ /*
306
+ NOTE@coder: they renamed createChannelReceiver and made it part of the ProxyChannel namespace
307
+ See: https://github.com/microsoft/vscode/commit/e371faebfb679ca0dcdb61f4f2f33b3d69922a77
308
+
309
+ And see this as an example similar to our code below:
310
+ https://github.com/microsoft/vscode/blob/e371faebfb679ca0dcdb61f4f2f33b3d69922a77/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts#L273
311
+ 3/11/2021 by @jsjoeio
312
+ */
313
+ this . ipc . registerChannel ( 'localizations' , < IServerChannel < any > > ProxyChannel . fromService ( accessor . get ( ILocalizationsService ) ) ) ;
290
314
this . ipc . registerChannel ( REMOTE_FILE_SYSTEM_CHANNEL_NAME , new FileProviderChannel ( environmentService , logService ) ) ;
291
315
this . ipc . registerChannel ( REMOTE_TERMINAL_CHANNEL_NAME , new TerminalProviderChannel ( logService ) ) ;
292
316
resolve ( new ErrorTelemetry ( telemetryService ) ) ;
0 commit comments