22/// <reference path="session.ts" />
33
44namespace ts . server {
5- interface IoSessionOptions {
6- host : ServerHost ;
7- cancellationToken : ServerCancellationToken ;
8- canUseEvents : boolean ;
9- /**
10- * If defined, specifies the socket used to send events to the client.
11- * Otherwise, events are sent through the host.
12- */
13- eventPort ?: number ;
14- useSingleInferredProject : boolean ;
15- useInferredProjectPerProjectRoot : boolean ;
16- disableAutomaticTypingAcquisition : boolean ;
17- globalTypingsCacheLocation : string ;
18- logger : Logger ;
19- typingSafeListLocation : string ;
20- typesMapLocation : string | undefined ;
21- npmLocation : string | undefined ;
22- telemetryEnabled : boolean ;
23- globalPlugins : ReadonlyArray < string > ;
24- pluginProbeLocations : ReadonlyArray < string > ;
25- allowLocalPluginLoads : boolean ;
26- }
27-
285 const childProcess : {
296 fork ( modulePath : string , args : string [ ] , options ?: { execArgv : string [ ] , env ?: MapLike < string > } ) : NodeChildProcess ;
307 execFileSync ( file : string , args : string [ ] , options : { stdio : "ignore" , env : MapLike < string > } ) : string | Buffer ;
@@ -505,9 +482,7 @@ namespace ts.server {
505482 private socketEventQueue : { body : any , eventName : string } [ ] | undefined ;
506483 private constructed : boolean | undefined ;
507484
508- constructor ( options : IoSessionOptions ) {
509- const { host, eventPort, globalTypingsCacheLocation, typingSafeListLocation, typesMapLocation, npmLocation, canUseEvents } = options ;
510-
485+ constructor ( ) {
511486 const event : Event | undefined = ( body : object , eventName : string ) => {
512487 if ( this . constructed ) {
513488 this . event ( body , eventName ) ;
@@ -521,9 +496,11 @@ namespace ts.server {
521496 }
522497 } ;
523498
499+ const host = sys ;
500+
524501 const typingsInstaller = disableAutomaticTypingAcquisition
525502 ? undefined
526- : new NodeTypingsInstaller ( telemetryEnabled , logger , host , globalTypingsCacheLocation , typingSafeListLocation , typesMapLocation , npmLocation , event ) ;
503+ : new NodeTypingsInstaller ( telemetryEnabled , logger , host , getGlobalTypingsCacheLocation ( ) , typingSafeListLocation , typesMapLocation , npmLocation , event ) ;
527504
528505 super ( {
529506 host,
@@ -534,10 +511,10 @@ namespace ts.server {
534511 byteLength : Buffer . byteLength ,
535512 hrtime : process . hrtime ,
536513 logger,
537- canUseEvents,
538- globalPlugins : options . globalPlugins ,
539- pluginProbeLocations : options . pluginProbeLocations ,
540- allowLocalPluginLoads : options . allowLocalPluginLoads
514+ canUseEvents : eventPort !== undefined ,
515+ globalPlugins,
516+ pluginProbeLocations,
517+ allowLocalPluginLoads,
541518 } ) ;
542519
543520 this . eventPort = eventPort ;
@@ -952,31 +929,12 @@ namespace ts.server {
952929 const disableAutomaticTypingAcquisition = hasArgument ( "--disableAutomaticTypingAcquisition" ) ;
953930 const telemetryEnabled = hasArgument ( Arguments . EnableTelemetry ) ;
954931
955- const options : IoSessionOptions = {
956- host : sys ,
957- cancellationToken,
958- eventPort,
959- canUseEvents : true ,
960- useSingleInferredProject,
961- useInferredProjectPerProjectRoot,
962- disableAutomaticTypingAcquisition,
963- globalTypingsCacheLocation : getGlobalTypingsCacheLocation ( ) ,
964- typingSafeListLocation,
965- typesMapLocation,
966- npmLocation,
967- telemetryEnabled,
968- logger,
969- globalPlugins,
970- pluginProbeLocations,
971- allowLocalPluginLoads
972- } ;
973-
974932 logger . info ( `Starting TS Server` ) ;
975933 logger . info ( `Version: ${ version } ` ) ;
976934 logger . info ( `Arguments: ${ process . argv . join ( " " ) } ` ) ;
977935 logger . info ( `Platform: ${ os . platform ( ) } NodeVersion: ${ nodeVersion } CaseSensitive: ${ sys . useCaseSensitiveFileNames } ` ) ;
978936
979- const ioSession = new IOSession ( options ) ;
937+ const ioSession = new IOSession ( ) ;
980938 process . on ( "uncaughtException" , err => {
981939 ioSession . logError ( err , "unknown" ) ;
982940 } ) ;
0 commit comments