@@ -10,20 +10,38 @@ import { sanitizeFilePath } from "vs/base/common/extpath";
1010import { getMediaMime } from "vs/base/common/mime" ;
1111import { extname } from "vs/base/common/path" ;
1212import { UriComponents , URI } from "vs/base/common/uri" ;
13- import { IPCServer , ClientConnectionEvent } from "vs/base/parts/ipc/common/ipc" ;
13+ import { IPCServer , ClientConnectionEvent , StaticRouter } from "vs/base/parts/ipc/common/ipc" ;
1414import { LogsDataCleaner } from "vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner" ;
15+ import { IConfigurationService } from "vs/platform/configuration/common/configuration" ;
16+ import { ConfigurationService } from "vs/platform/configuration/node/configurationService" ;
17+ import { IDialogService } from "vs/platform/dialogs/common/dialogs" ;
18+ import { DialogChannelClient } from "vs/platform/dialogs/node/dialogIpc" ;
19+ import { IDownloadService } from "vs/platform/download/common/download" ;
20+ import { DownloadServiceChannelClient } from "vs/platform/download/node/downloadIpc" ;
1521import { IEnvironmentService , ParsedArgs } from "vs/platform/environment/common/environment" ;
1622import { EnvironmentService } from "vs/platform/environment/node/environmentService" ;
23+ import { IExtensionManagementService , IExtensionGalleryService } from "vs/platform/extensionManagement/common/extensionManagement" ;
24+ import { ExtensionGalleryService } from "vs/platform/extensionManagement/node/extensionGalleryService" ;
25+ import { ExtensionManagementChannel } from "vs/platform/extensionManagement/node/extensionManagementIpc" ;
26+ import { ExtensionManagementService } from "vs/platform/extensionManagement/node/extensionManagementService" ;
27+ import { SyncDescriptor } from "vs/platform/instantiation/common/descriptors" ;
1728import { InstantiationService } from "vs/platform/instantiation/common/instantiationService" ;
1829import { ServiceCollection } from "vs/platform/instantiation/common/serviceCollection" ;
30+ import { ILocalizationsService } from "vs/platform/localizations/common/localizations" ;
31+ import { LocalizationsService } from "vs/platform/localizations/node/localizations" ;
1932import { getLogLevel , ILogService } from "vs/platform/log/common/log" ;
2033import { LogLevelSetterChannel } from "vs/platform/log/common/logIpc" ;
2134import { SpdLogService } from "vs/platform/log/node/spdlogService" ;
2235import { IProductConfiguration } from "vs/platform/product/common/product" ;
2336import product from "vs/platform/product/node/product" ;
2437import { ConnectionType , ConnectionTypeRequest } from "vs/platform/remote/common/remoteAgentConnection" ;
2538import { REMOTE_FILE_SYSTEM_CHANNEL_NAME } from "vs/platform/remote/common/remoteAgentFileSystemChannel" ;
39+ import { IRequestService } from "vs/platform/request/node/request" ;
40+ import { RequestService } from "vs/platform/request/node/requestService" ;
41+ import { ITelemetryService } from "vs/platform/telemetry/common/telemetry" ;
42+ import { NullTelemetryService } from "vs/platform/telemetry/common/telemetryUtils" ;
2643import { RemoteExtensionLogFileName } from "vs/workbench/services/remote/common/remoteAgentService" ;
44+ // import { TelemetryService } from "vs/workbench/services/telemetry/electron-browser/telemetryService";
2745import { IWorkbenchConstructionOptions } from "vs/workbench/workbench.web.api" ;
2846
2947import { Connection , ManagementConnection , ExtensionHostConnection } from "vs/server/connection" ;
@@ -141,28 +159,35 @@ export class MainServer extends Server {
141159 } ) ;
142160
143161 const environmentService = new EnvironmentService ( args , process . execPath ) ;
144- this . services . set ( IEnvironmentService , environmentService ) ;
162+ const logService = new SpdLogService ( RemoteExtensionLogFileName , environmentService . logsPath , getLogLevel ( environmentService ) ) ;
163+ this . ipc . registerChannel ( "loglevel" , new LogLevelSetterChannel ( logService ) ) ;
145164
146- const logService = new SpdLogService (
147- RemoteExtensionLogFileName ,
148- environmentService . logsPath ,
149- getLogLevel ( environmentService ) ,
150- ) ;
151- this . services . set ( ILogService , logService ) ;
165+ const router = new StaticRouter ( ( context : any ) => {
166+ console . log ( "static router" , context ) ;
167+ return context . clientId === "renderer" ;
168+ } ) ;
152169
153- this . ipc . registerChannel ( "loglevel" , new LogLevelSetterChannel ( logService ) ) ;
170+ this . services . set ( ILogService , logService ) ;
171+ this . services . set ( IEnvironmentService , environmentService ) ;
172+ this . services . set ( IConfigurationService , new SyncDescriptor ( ConfigurationService , [ environmentService . machineSettingsResource ] ) ) ;
173+ this . services . set ( IRequestService , new SyncDescriptor ( RequestService ) ) ;
174+ this . services . set ( IExtensionGalleryService , new SyncDescriptor ( ExtensionGalleryService ) ) ;
175+ this . services . set ( ITelemetryService , NullTelemetryService ) ; // TODO: telemetry
176+ this . services . set ( IDialogService , new DialogChannelClient ( this . ipc . getChannel ( "dialog" , router ) ) ) ;
177+ this . services . set ( IDownloadService , new DownloadServiceChannelClient ( this . ipc . getChannel ( "download" , router ) , ( ) => getUriTransformer ( "renderer" ) ) ) ;
178+ this . services . set ( IExtensionManagementService , new SyncDescriptor ( ExtensionManagementService ) ) ;
154179
155180 const instantiationService = new InstantiationService ( this . services ) ;
181+
182+ this . services . set ( ILocalizationsService , instantiationService . createInstance ( LocalizationsService ) ) ;
183+
156184 instantiationService . invokeFunction ( ( ) => {
157185 instantiationService . createInstance ( LogsDataCleaner ) ;
158- this . ipc . registerChannel (
159- REMOTE_FILE_SYSTEM_CHANNEL_NAME ,
160- new FileProviderChannel ( logService ) ,
161- ) ;
162- this . ipc . registerChannel (
163- "remoteextensionsenvironment" ,
164- new ExtensionEnvironmentChannel ( environmentService , logService ) ,
165- ) ;
186+ this . ipc . registerChannel ( REMOTE_FILE_SYSTEM_CHANNEL_NAME , new FileProviderChannel ( logService ) ) ;
187+ this . ipc . registerChannel ( "remoteextensionsenvironment" , new ExtensionEnvironmentChannel ( environmentService , logService ) ) ;
188+ const extensionsService = this . services . get ( IExtensionManagementService ) as IExtensionManagementService ;
189+ const extensionsChannel = new ExtensionManagementChannel ( extensionsService , ( context ) => getUriTransformer ( context . remoteAuthority ) ) ;
190+ this . ipc . registerChannel ( "extensions" , extensionsChannel ) ;
166191 } ) ;
167192 }
168193
0 commit comments