diff --git a/src/vs/workbench/electron-browser/desktop.main.ts b/src/vs/workbench/electron-browser/desktop.main.ts index 8326d04ea8059d4db203617e2893984d7d46050a..f016f9afd4a42f3ed3a5631da369f81f77c73963 100644 --- a/src/vs/workbench/electron-browser/desktop.main.ts +++ b/src/vs/workbench/electron-browser/desktop.main.ts @@ -164,10 +164,19 @@ class DesktopMain extends Disposable { private async initServices(): Promise<{ serviceCollection: ServiceCollection, logService: ILogService, storageService: NativeStorageService }> { const serviceCollection = new ServiceCollection(); - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // NOTE: DO NOT ADD ANY OTHER SERVICE INTO THE COLLECTION HERE. - // CONTRIBUTE IT VIA WORKBENCH.DESKTOP.MAIN.TS AND registerSingleton(). - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // Main Process const mainProcessService = this._register(new MainProcessService(this.configuration.windowId)); @@ -188,6 +197,20 @@ class DesktopMain extends Disposable { const remoteAuthorityResolverService = new RemoteAuthorityResolverService(); serviceCollection.set(IRemoteAuthorityResolverService, remoteAuthorityResolverService); + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + // Sign const signService = new SignService(); serviceCollection.set(ISignService, signService); @@ -210,6 +233,20 @@ class DesktopMain extends Disposable { // User Data Provider fileService.registerProvider(Schemas.userData, new FileUserDataProvider(this.environmentService.appSettingsHome, this.environmentService.configuration.backupPath ? URI.file(this.environmentService.configuration.backupPath) : undefined, diskFileSystemProvider, this.environmentService, logService)); + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + const connection = remoteAgentService.getConnection(); if (connection) { const remoteFileSystemProvider = this._register(new RemoteFileSystemProvider(remoteAgentService)); @@ -242,6 +279,20 @@ class DesktopMain extends Disposable { }) ]); + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + return { serviceCollection, logService, storageService: services[1] }; } diff --git a/src/vs/workbench/electron-sandbox/desktop.main.ts b/src/vs/workbench/electron-sandbox/desktop.main.ts index 670fae19c8411866f8527084fceddf3ec9cb485c..6fe191f5a5b3cc93ce4755f7c51d91c535d2a822 100644 --- a/src/vs/workbench/electron-sandbox/desktop.main.ts +++ b/src/vs/workbench/electron-sandbox/desktop.main.ts @@ -140,10 +140,18 @@ class DesktopMain extends Disposable { private async initServices(): Promise<{ serviceCollection: ServiceCollection, logService: ILogService, storageService: SimpleStorageService }> { const serviceCollection = new ServiceCollection(); - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // NOTE: DO NOT ADD ANY OTHER SERVICE INTO THE COLLECTION HERE. - // CONTRIBUTE IT VIA WORKBENCH.DESKTOP.MAIN.TS AND registerSingleton(). - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // Main Process const mainProcessService = this._register(new MainProcessService(this.configuration.windowId)); @@ -173,6 +181,20 @@ class DesktopMain extends Disposable { const remoteAgentService = new SimpleRemoteAgentService(); serviceCollection.set(IRemoteAgentService, remoteAgentService); + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + // Native Host const nativeHostService = new NativeHostService(this.configuration.windowId, mainProcessService) as INativeHostService; serviceCollection.set(INativeHostService, nativeHostService); @@ -195,6 +217,20 @@ class DesktopMain extends Disposable { const resourceIdentityService = new SimpleResourceIdentityService(); serviceCollection.set(IResourceIdentityService, resourceIdentityService); + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + const services = await Promise.all([ this.createWorkspaceService().then(service => { @@ -216,6 +252,20 @@ class DesktopMain extends Disposable { }) ]); + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // NOTE: Please do NOT register services here. Use `registerSingleton()` + // from `workbench.common.main.ts` if the service is shared between + // desktop and web or `workbench.sandbox.main.ts` if the service + // is desktop only. + // + // DO NOT add services to `workbench.desktop.main.ts`, always add + // to `workbench.sandbox.main.ts` to support our Electron sandbox + // + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + return { serviceCollection, logService, storageService: services[1] }; } diff --git a/src/vs/workbench/workbench.desktop.main.ts b/src/vs/workbench/workbench.desktop.main.ts index acf5c492a18c5fe809c45ad970e571d063667875..5d4c5a4210978511a897b0cea0af410d7f3d4b13 100644 --- a/src/vs/workbench/workbench.desktop.main.ts +++ b/src/vs/workbench/workbench.desktop.main.ts @@ -4,11 +4,16 @@ *--------------------------------------------------------------------------------------------*/ -// ####################################################################### -// ### ### -// ### !!! PLEASE ADD COMMON IMPORTS INTO WORKBENCH.COMMON.MAIN.TS !!! ### -// ### ### -// ####################################################################### +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //#region --- workbench common & sandbox @@ -25,6 +30,18 @@ import 'vs/workbench/electron-browser/actions/developerActions'; //#endregion +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //#region --- workbench (desktop main) import 'vs/workbench/electron-browser/desktop.main'; @@ -34,6 +51,19 @@ import 'vs/workbench/electron-browser/desktop.main'; //#region --- workbench services + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + import 'vs/workbench/services/integrity/node/integrityService'; import 'vs/workbench/services/search/electron-browser/searchService'; import 'vs/workbench/services/output/electron-browser/outputChannelModelService'; @@ -55,6 +85,19 @@ import 'vs/workbench/services/localizations/electron-browser/localizationsServic import 'vs/workbench/services/diagnostics/electron-browser/diagnosticsService'; import 'vs/workbench/services/experiment/electron-browser/experimentService'; + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { ICredentialsService } from 'vs/platform/credentials/common/credentials'; import { KeytarCredentialsService } from 'vs/platform/credentials/node/credentialsService'; @@ -67,6 +110,18 @@ registerSingleton(ITunnelService, TunnelService); //#endregion +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //#region --- workbench contributions // Tags @@ -82,6 +137,19 @@ import 'vs/workbench/contrib/debug/node/debugHelperService'; // Webview import 'vs/workbench/contrib/webview/electron-browser/webview.contribution'; + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + // Notebook import 'vs/workbench/contrib/notebook/electron-browser/notebook.contribution'; @@ -97,6 +165,19 @@ import 'vs/workbench/contrib/codeEditor/electron-browser/codeEditor.contribution // External Terminal import 'vs/workbench/contrib/externalTerminal/node/externalTerminal.contribution'; + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + // Performance import 'vs/workbench/contrib/performance/electron-browser/performance.contribution'; @@ -109,4 +190,17 @@ import 'vs/workbench/contrib/tasks/electron-browser/taskService'; // User Data Sync import 'vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution'; + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// NOTE: Please do NOT register services here. Use `registerSingleton()` +// from `workbench.common.main.ts` if the service is shared between +// desktop and web or `workbench.sandbox.main.ts` if the service +// is desktop only. +// +// The `node` & `electron-browser` layer is deprecated for workbench! +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + //#endregion