@@ -7,7 +7,7 @@ import { Emitter } from 'vs/base/common/event';
77import { Schemas } from 'vs/base/common/network' ;
88import { URI } from 'vs/base/common/uri' ;
99import { 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' ;
1111import { LogsDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner' ;
1212import { main } from 'vs/code/node/cliProcessMain' ;
1313import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
@@ -28,10 +28,10 @@ import { InstantiationService } from 'vs/platform/instantiation/common/instantia
2828import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection' ;
2929import { ILocalizationsService } from 'vs/platform/localizations/common/localizations' ;
3030import { 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' ;
3333import { 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 ' ;
3535import product from 'vs/platform/product/common/product' ;
3636import { IProductService } from 'vs/platform/product/common/productService' ;
3737import { ConnectionType , ConnectionTypeRequest } from 'vs/platform/remote/common/remoteAgentConnection' ;
@@ -212,11 +212,27 @@ export class Vscode {
212212 }
213213
214214 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+ */
215221 const environmentService = new NativeEnvironmentService ( args ) ;
216222 // https://github.com/cdr/code-server/issues/1693
217223 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 )
220236 const fileService = new FileService ( logService ) ;
221237 fileService . registerProvider ( Schemas . file , new DiskFileSystemProvider ( logService ) ) ;
222238
@@ -286,7 +302,15 @@ export class Vscode {
286302 ) ) ;
287303 this . ipc . registerChannel ( 'request' , new RequestChannel ( accessor . get ( IRequestService ) ) ) ;
288304 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 ) ) ) ;
290314 this . ipc . registerChannel ( REMOTE_FILE_SYSTEM_CHANNEL_NAME , new FileProviderChannel ( environmentService , logService ) ) ;
291315 this . ipc . registerChannel ( REMOTE_TERMINAL_CHANNEL_NAME , new TerminalProviderChannel ( logService ) ) ;
292316 resolve ( new ErrorTelemetry ( telemetryService ) ) ;
0 commit comments