@@ -19,7 +19,7 @@ namespace ts.server {
19
19
connect ( options : { port : number } , onConnect ?: ( ) => void ) : NodeSocket
20
20
} = require ( "net" ) ;
21
21
22
- const getGlobalTypingsCacheLocation = function ( ) {
22
+ const getGlobalTypingsCacheLocation = ( ) => {
23
23
switch ( process . platform ) {
24
24
case "win32" : {
25
25
const basePath = process . env . LOCALAPPDATA ||
@@ -42,9 +42,9 @@ namespace ts.server {
42
42
default :
43
43
return Debug . fail ( `unsupported platform '${ process . platform } '` ) ;
44
44
}
45
- }
45
+ } ;
46
46
47
- const getNonWindowsCacheLocation = function ( platformIsDarwin : boolean ) {
47
+ const getNonWindowsCacheLocation = ( platformIsDarwin : boolean ) => {
48
48
if ( process . env . XDG_CACHE_HOME ) {
49
49
return process . env . XDG_CACHE_HOME ;
50
50
}
@@ -57,7 +57,7 @@ namespace ts.server {
57
57
? "Library/Caches"
58
58
: ".cache" ;
59
59
return combinePaths ( normalizeSlashes ( homePath ) , cacheFolder ) ;
60
- }
60
+ } ;
61
61
62
62
interface NodeChildProcess {
63
63
send ( message : any , sendHandle ?: any ) : void ;
@@ -591,7 +591,7 @@ namespace ts.server {
591
591
logToFile ?: boolean ;
592
592
}
593
593
594
- const parseLoggingEnvironmentString = function ( logEnvStr : string | undefined ) : LogOptions {
594
+ const parseLoggingEnvironmentString = ( logEnvStr : string | undefined ) : LogOptions => {
595
595
if ( ! logEnvStr ) {
596
596
return { } ;
597
597
}
@@ -636,9 +636,9 @@ namespace ts.server {
636
636
}
637
637
return { value : stripQuotes ( pathStart ) , extraPartCounter } ;
638
638
}
639
- }
639
+ } ;
640
640
641
- const getLogLevel = function ( level : string | undefined ) {
641
+ const getLogLevel = ( level : string | undefined ) => {
642
642
if ( level ) {
643
643
const l = level . toLowerCase ( ) ;
644
644
for ( const name in LogLevel ) {
@@ -648,10 +648,10 @@ namespace ts.server {
648
648
}
649
649
}
650
650
return undefined ;
651
- }
651
+ } ;
652
652
653
653
// TSS_LOG "{ level: "normal | verbose | terse", file?: string}"
654
- const createLogger = function ( ) {
654
+ const createLogger = ( ) => {
655
655
const cmdLineLogFileName = findArgument ( "--logFile" ) ;
656
656
const cmdLineVerbosity = getLogLevel ( findArgument ( "--logVerbosity" ) ) ;
657
657
const envLogOptions = parseLoggingEnvironmentString ( process . env . TSS_LOG ) ;
@@ -668,13 +668,13 @@ namespace ts.server {
668
668
669
669
const logVerbosity = cmdLineVerbosity || envLogOptions . detailLevel ;
670
670
return new Logger ( substitutedLogFileName ! , envLogOptions . traceToConsole ! , logVerbosity ! ) ; // TODO: GH#18217
671
- }
671
+ } ;
672
672
// This places log file in the directory containing editorServices.js
673
673
// TODO: check that this location is writable
674
674
675
675
// average async stat takes about 30 microseconds
676
676
// set chunk size to do 30 files in < 1 millisecond
677
- const createPollingWatchedFileSet = function ( interval = 2500 , chunkSize = 30 ) {
677
+ const createPollingWatchedFileSet = ( interval = 2500 , chunkSize = 30 ) => {
678
678
const watchedFiles : WatchedFile [ ] = [ ] ;
679
679
let nextFileToCheck = 0 ;
680
680
return { getModifiedTime, poll, startWatchTimer, addFile, removeFile } ;
@@ -750,7 +750,7 @@ namespace ts.server {
750
750
function removeFile ( file : WatchedFile ) {
751
751
unorderedRemoveItem ( watchedFiles , file ) ;
752
752
}
753
- }
753
+ } ;
754
754
755
755
// REVIEW: for now this implementation uses polling.
756
756
// The advantage of polling is that it works reliably
@@ -770,24 +770,24 @@ namespace ts.server {
770
770
const pending : Buffer [ ] = [ ] ;
771
771
let canWrite = true ;
772
772
773
- const writeMessage = function ( buf : Buffer ) {
773
+ const writeMessage = ( buf : Buffer ) => {
774
774
if ( ! canWrite ) {
775
775
pending . push ( buf ) ;
776
776
}
777
777
else {
778
778
canWrite = false ;
779
779
process . stdout . write ( buf , setCanWriteFlagAndWriteMessageIfNecessary ) ;
780
780
}
781
- }
781
+ } ;
782
782
783
- const setCanWriteFlagAndWriteMessageIfNecessary = function ( ) {
783
+ const setCanWriteFlagAndWriteMessageIfNecessary = ( ) => {
784
784
canWrite = true ;
785
785
if ( pending . length ) {
786
786
writeMessage ( pending . shift ( ) ! ) ;
787
787
}
788
- }
788
+ } ;
789
789
790
- const extractWatchDirectoryCacheKey = function ( path : string , currentDriveKey : string | undefined ) {
790
+ const extractWatchDirectoryCacheKey = ( path : string , currentDriveKey : string | undefined ) => {
791
791
path = normalizeSlashes ( path ) ;
792
792
if ( isUNCPath ( path ) ) {
793
793
// UNC path: extract server name
@@ -811,11 +811,11 @@ namespace ts.server {
811
811
}
812
812
// do not cache any other cases
813
813
return undefined ;
814
- }
814
+ } ;
815
815
816
- const isUNCPath = function ( s : string ) : boolean {
816
+ const isUNCPath = ( s : string ) : boolean => {
817
817
return s . length > 2 && s . charCodeAt ( 0 ) === CharacterCodes . slash && s . charCodeAt ( 1 ) === CharacterCodes . slash ;
818
- }
818
+ } ;
819
819
820
820
const logger = createLogger ( ) ;
821
821
@@ -827,15 +827,15 @@ namespace ts.server {
827
827
const noopWatcher : FileWatcher = { close : noop } ;
828
828
// This is the function that catches the exceptions when watching directory, and yet lets project service continue to function
829
829
// Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
830
- const watchDirectorySwallowingException = function ( path : string , callback : DirectoryWatcherCallback , recursive ?: boolean , options ?: WatchOptions ) : FileWatcher {
830
+ const watchDirectorySwallowingException = ( path : string , callback : DirectoryWatcherCallback , recursive ?: boolean , options ?: WatchOptions ) : FileWatcher => {
831
831
try {
832
832
return originalWatchDirectory ( path , callback , recursive , options ) ;
833
833
}
834
834
catch ( e ) {
835
835
logger . info ( `Exception when creating directory watcher: ${ e . message } ` ) ;
836
836
return noopWatcher ;
837
837
}
838
- }
838
+ } ;
839
839
840
840
if ( useWatchGuard ) {
841
841
const currentDrive = extractWatchDirectoryCacheKey ( sys . resolvePath ( sys . getCurrentDirectory ( ) ) , /*currentDriveKey*/ undefined ) ;
@@ -923,10 +923,10 @@ namespace ts.server {
923
923
cancellationToken = nullCancellationToken ;
924
924
}
925
925
926
- const parseEventPort = function ( eventPortStr : string | undefined ) {
926
+ const parseEventPort = ( eventPortStr : string | undefined ) => {
927
927
const eventPort = eventPortStr === undefined ? undefined : parseInt ( eventPortStr ) ;
928
928
return eventPort !== undefined && ! isNaN ( eventPort ) ? eventPort : undefined ;
929
- }
929
+ } ;
930
930
const eventPort : number | undefined = parseEventPort ( findArgument ( "--eventPort" ) ) ;
931
931
932
932
const localeStr = findArgument ( "--locale" ) ;
@@ -941,13 +941,13 @@ namespace ts.server {
941
941
const npmLocation = findArgument ( Arguments . NpmLocation ) ;
942
942
const validateDefaultNpmLocation = hasArgument ( Arguments . ValidateDefaultNpmLocation ) ;
943
943
944
- const parseStringArray = function ( argName : string ) : readonly string [ ] {
944
+ const parseStringArray = ( argName : string ) : readonly string [ ] => {
945
945
const arg = findArgument ( argName ) ;
946
946
if ( arg === undefined ) {
947
947
return emptyArray ;
948
948
}
949
949
return arg . split ( "," ) . filter ( name => name !== "" ) ;
950
- }
950
+ } ;
951
951
952
952
const globalPlugins = parseStringArray ( "--globalPlugins" ) ;
953
953
const pluginProbeLocations = parseStringArray ( "--pluginProbeLocations" ) ;
0 commit comments