@@ -14,6 +14,7 @@ import 'vs/css!vs/workbench/browser/media/vs-theme';
1414import 'vs/css!vs/workbench/browser/media/vs-dark-theme' ;
1515import 'vs/css!vs/workbench/browser/media/hc-black-theme' ;
1616
17+ import * as nls from 'vs/nls' ;
1718import { TPromise } from 'vs/base/common/winjs.base' ;
1819import { Dimension , Builder , $ } from 'vs/base/browser/builder' ;
1920import objects = require( 'vs/base/common/objects' ) ;
@@ -100,6 +101,7 @@ import { IServiceCtor, isServiceEvent } from 'vs/base/common/service';
100101import { connect , Client } from 'vs/base/node/service.net' ;
101102import { IExtensionsService } from 'vs/workbench/parts/extensions/common/extensions' ;
102103import { ExtensionsService } from 'vs/workbench/parts/extensions/node/extensionsService' ;
104+ import { ReloadWindowAction } from 'vs/workbench/electron-browser/actions' ;
103105
104106/**
105107 * This ugly code is needed because at the point when we need shared services
@@ -149,7 +151,7 @@ export function getDelayedService<TService>(clientPromise: TPromise<Client>, ser
149151 return servicePromise ( ) . then ( service => service [ key ] ( ...args ) ) ;
150152 }
151153 } ) ;
152- } , < TService > { } ) ;
154+ } , { } as TService ) ;
153155}
154156
155157/**
@@ -200,20 +202,28 @@ export class WorkbenchShell {
200202 let workbenchContainer = $ ( parent ) . div ( ) ;
201203
202204 // Instantiation service with services
203- let service = this . initInstantiationService ( ) ;
205+ let instantiationService = this . initInstantiationService ( ) ;
204206
205207 //crash reporting
206208 if ( ! ! this . configuration . env . crashReporter ) {
207- let crashReporter = service . createInstance ( CrashReporter , this . configuration . env . version , this . configuration . env . commitHash ) ;
209+ let crashReporter = instantiationService . createInstance ( CrashReporter , this . configuration . env . version , this . configuration . env . commitHash ) ;
208210 crashReporter . start ( this . configuration . env . crashReporter ) ;
209211 }
210212
211213 const sharedProcessClientPromise = connect ( process . env [ 'VSCODE_SHARED_IPC_HOOK' ] ) ;
212- sharedProcessClientPromise . done ( null , errors . onUnexpectedError ) ;
213- service . addSingleton ( IExtensionsService , getDelayedService < IExtensionsService > ( sharedProcessClientPromise , 'ExtensionService' , ExtensionsService ) ) ;
214+ sharedProcessClientPromise . done ( service => {
215+ service . onClose ( ( ) => {
216+ this . messageService . show ( Severity . Error , {
217+ message : nls . localize ( 'sharedProcessCrashed' , "The shared process terminated unexpectedly. Please reload the window." ) ,
218+ actions : [ instantiationService . createInstance ( ReloadWindowAction , ReloadWindowAction . ID , ReloadWindowAction . LABEL ) ]
219+ } ) ;
220+ } ) ;
221+ } , errors . onUnexpectedError ) ;
222+
223+ instantiationService . addSingleton ( IExtensionsService , getDelayedService < IExtensionsService > ( sharedProcessClientPromise , 'ExtensionService' , ExtensionsService ) ) ;
214224
215225 // Workbench
216- this . workbench = new Workbench ( workbenchContainer . getHTMLElement ( ) , this . workspace , this . configuration , this . options , service ) ;
226+ this . workbench = new Workbench ( workbenchContainer . getHTMLElement ( ) , this . workspace , this . configuration , this . options , instantiationService ) ;
217227 this . workbench . startup ( {
218228 onServicesCreated : ( ) => {
219229 this . initPluginSystem ( ) ;
0 commit comments