|
5 | 5 |
|
6 | 6 | import * as nls from 'vs/nls'; |
7 | 7 | import * as perf from 'vs/base/common/performance'; |
8 | | -import { Shell } from 'vs/workbench/electron-browser/shell'; |
| 8 | +import { Workbench } from 'vs/workbench/electron-browser/workbench'; |
| 9 | +import { ElectronWindow } from 'vs/workbench/electron-browser/window'; |
9 | 10 | import * as browser from 'vs/base/browser/browser'; |
10 | 11 | import { domContentLoaded } from 'vs/base/browser/dom'; |
11 | 12 | import { onUnexpectedError } from 'vs/base/common/errors'; |
@@ -47,6 +48,10 @@ import { createHash } from 'crypto'; |
47 | 48 | import { IdleValue } from 'vs/base/common/async'; |
48 | 49 | import { setGlobalLeakWarningThreshold } from 'vs/base/common/event'; |
49 | 50 | import { GlobalStorageDatabaseChannelClient } from 'vs/platform/storage/node/storageIpc'; |
| 51 | +import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; |
| 52 | +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; |
| 53 | +import { IStorageService } from 'vs/platform/storage/common/storage'; |
| 54 | +import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; |
50 | 55 |
|
51 | 56 | gracefulFs.gracefulify(fs); // enable gracefulFs |
52 | 57 |
|
@@ -126,20 +131,35 @@ function openWorkbench(configuration: IWindowConfiguration): Promise<void> { |
126 | 131 | const workspaceService = services[0]; |
127 | 132 | const storageService = services[1]; |
128 | 133 |
|
| 134 | + // Core services |
| 135 | + const serviceCollection = new ServiceCollection(); |
| 136 | + serviceCollection.set(IWorkspaceContextService, workspaceService); |
| 137 | + serviceCollection.set(IConfigurationService, workspaceService); |
| 138 | + serviceCollection.set(IEnvironmentService, environmentService); |
| 139 | + serviceCollection.set(ILogService, logService); |
| 140 | + serviceCollection.set(IStorageService, storageService); |
| 141 | + |
| 142 | + mainServices.forEach((serviceIdentifier, serviceInstance) => { |
| 143 | + serviceCollection.set(serviceIdentifier, serviceInstance); |
| 144 | + }); |
| 145 | + |
| 146 | + const instantiationService = new InstantiationService(serviceCollection, true); |
| 147 | + |
129 | 148 | return domContentLoaded().then(() => { |
130 | 149 | perf.mark('willStartWorkbench'); |
131 | 150 |
|
132 | | - // Create Shell |
133 | | - const shell = new Shell(document.body, { |
134 | | - contextService: workspaceService, |
135 | | - configurationService: workspaceService, |
136 | | - environmentService, |
137 | | - logService, |
138 | | - storageService |
139 | | - }, mainServices, mainProcessClient, configuration); |
140 | | - |
141 | | - // Open Shell |
142 | | - shell.open(); |
| 151 | + // Startup Workbench |
| 152 | + const workbench = instantiationService.createInstance( |
| 153 | + Workbench, |
| 154 | + document.body, |
| 155 | + configuration, |
| 156 | + serviceCollection, |
| 157 | + mainProcessClient |
| 158 | + ); |
| 159 | + workbench.startup(); |
| 160 | + |
| 161 | + // Window |
| 162 | + workbench.getInstantiationService().createInstance(ElectronWindow); |
143 | 163 |
|
144 | 164 | // Inform user about loading issues from the loader |
145 | 165 | (<any>self).require.config({ |
|
0 commit comments