@@ -116,8 +116,6 @@ namespace ts.server {
116
116
birthtime : Date ;
117
117
}
118
118
119
- type RequireResult = { module : { } , error : undefined } | { module : undefined , error : { } } ;
120
-
121
119
const readline : {
122
120
createInterface ( options : ReadLineOptions ) : NodeJS . EventEmitter ;
123
121
} = require ( "readline" ) ;
@@ -333,62 +331,59 @@ namespace ts.server {
333
331
this . logger . info ( `Received response: ${ JSON . stringify ( response ) } ` ) ;
334
332
}
335
333
336
- if ( response . kind === EventInitializationFailed ) {
337
- if ( ! this . eventSender ) {
338
- return ;
339
- }
340
- const body : protocol . TypesInstallerInitializationFailedEventBody = {
341
- message : response . message
342
- } ;
343
- const eventName : protocol . TypesInstallerInitializationFailedEventName = "typesInstallerInitializationFailed" ;
344
- this . eventSender . event ( body , eventName ) ;
345
- return ;
346
- }
347
-
348
- if ( response . kind === EventBeginInstallTypes ) {
349
- if ( ! this . eventSender ) {
350
- return ;
351
- }
352
- const body : protocol . BeginInstallTypesEventBody = {
353
- eventId : response . eventId ,
354
- packages : response . packagesToInstall ,
355
- } ;
356
- const eventName : protocol . BeginInstallTypesEventName = "beginInstallTypes" ;
357
- this . eventSender . event ( body , eventName ) ;
334
+ switch ( response . kind ) {
335
+ case EventInitializationFailed :
336
+ if ( this . eventSender ) {
337
+ const body : protocol . TypesInstallerInitializationFailedEventBody = {
338
+ message : response . message
339
+ } ;
340
+ const eventName : protocol . TypesInstallerInitializationFailedEventName = "typesInstallerInitializationFailed" ;
341
+ this . eventSender . event ( body , eventName ) ;
342
+ }
343
+ break ;
358
344
359
- return ;
360
- }
345
+ case EventBeginInstallTypes :
346
+ if ( this . eventSender ) {
347
+ const body : protocol . BeginInstallTypesEventBody = {
348
+ eventId : response . eventId ,
349
+ packages : response . packagesToInstall ,
350
+ } ;
351
+ const eventName : protocol . BeginInstallTypesEventName = "beginInstallTypes" ;
352
+ this . eventSender . event ( body , eventName ) ;
353
+ }
354
+ break ;
361
355
362
- if ( response . kind === EventEndInstallTypes ) {
363
- if ( ! this . eventSender ) {
364
- return ;
365
- }
366
- if ( this . telemetryEnabled ) {
367
- const body : protocol . TypingsInstalledTelemetryEventBody = {
368
- telemetryEventName : "typingsInstalled" ,
369
- payload : {
370
- installedPackages : response . packagesToInstall . join ( "," ) ,
371
- installSuccess : response . installSuccess ,
372
- typingsInstallerVersion : response . typingsInstallerVersion
356
+ case EventEndInstallTypes :
357
+ debugger ; //kill
358
+ if ( this . eventSender ) {
359
+ if ( this . telemetryEnabled ) {
360
+ const body : protocol . TypingsInstalledTelemetryEventBody = {
361
+ telemetryEventName : "typingsInstalled" ,
362
+ payload : {
363
+ installedPackages : response . packagesToInstall . join ( "," ) ,
364
+ installSuccess : response . installSuccess ,
365
+ typingsInstallerVersion : response . typingsInstallerVersion
366
+ }
367
+ } ;
368
+ const eventName : protocol . TelemetryEventName = "telemetry" ;
369
+ this . eventSender . event ( body , eventName ) ;
373
370
}
374
- } ;
375
- const eventName : protocol . TelemetryEventName = "telemetry" ;
376
- this . eventSender . event ( body , eventName ) ;
377
- }
378
371
379
- const body : protocol . EndInstallTypesEventBody = {
380
- eventId : response . eventId ,
381
- packages : response . packagesToInstall ,
382
- success : response . installSuccess ,
383
- } ;
384
- const eventName : protocol . EndInstallTypesEventName = "endInstallTypes" ;
385
- this . eventSender . event ( body , eventName ) ;
386
- return ;
387
- }
372
+ const body : protocol . EndInstallTypesEventBody = {
373
+ eventId : response . eventId ,
374
+ packages : response . packagesToInstall ,
375
+ success : response . installSuccess ,
376
+ } ;
377
+ const eventName : protocol . EndInstallTypesEventName = "endInstallTypes" ;
378
+ this . eventSender . event ( body , eventName ) ;
379
+ }
380
+ break ;
388
381
389
- this . projectService . updateTypingsForProject ( response ) ;
390
- if ( response . kind === ActionSet && this . socket ) {
391
- this . sendEvent ( 0 , "setTypings" , response ) ;
382
+ default :
383
+ this . projectService . updateTypingsForProject ( response ) ; //uh, when does this happen?
384
+ if ( response . kind === ActionSet && this . socket ) {
385
+ this . sendEvent ( 0 , "setTypings" , response ) ;
386
+ }
392
387
}
393
388
}
394
389
}
0 commit comments