@@ -972,81 +972,91 @@ export default class TypeScriptServiceClient extends Disposable implements IType
972
972
spans : diagnosticEvent . body . spans ,
973
973
} ) ;
974
974
}
975
- break ;
975
+ return ;
976
976
}
977
977
case EventName . configFileDiag :
978
978
this . _onConfigDiagnosticsReceived . fire ( event as Proto . ConfigFileDiagnosticEvent ) ;
979
- break ;
979
+ return ;
980
980
981
981
case EventName . telemetry : {
982
982
const body = ( event as Proto . TelemetryEvent ) . body ;
983
983
this . dispatchTelemetryEvent ( body ) ;
984
- break ;
984
+ return ;
985
985
}
986
986
case EventName . projectLanguageServiceState : {
987
987
const body = ( event as Proto . ProjectLanguageServiceStateEvent ) . body ! ;
988
988
if ( this . serverState . type === ServerState . Type . Running ) {
989
989
this . serverState . updateLanguageServiceEnabled ( body . languageServiceEnabled ) ;
990
990
}
991
991
this . _onProjectLanguageServiceStateChanged . fire ( body ) ;
992
- break ;
992
+ return ;
993
993
}
994
994
case EventName . projectsUpdatedInBackground : {
995
995
this . loadingIndicator . reset ( ) ;
996
996
997
997
const body = ( event as Proto . ProjectsUpdatedInBackgroundEvent ) . body ;
998
998
const resources = body . openFiles . map ( file => this . toResource ( file ) ) ;
999
999
this . bufferSyncSupport . getErr ( resources ) ;
1000
- break ;
1000
+ return ;
1001
1001
}
1002
1002
case EventName . beginInstallTypes :
1003
1003
this . _onDidBeginInstallTypings . fire ( ( event as Proto . BeginInstallTypesEvent ) . body ) ;
1004
- break ;
1004
+ return ;
1005
1005
1006
1006
case EventName . endInstallTypes :
1007
1007
this . _onDidEndInstallTypings . fire ( ( event as Proto . EndInstallTypesEvent ) . body ) ;
1008
- break ;
1008
+ return ;
1009
1009
1010
1010
case EventName . typesInstallerInitializationFailed :
1011
1011
this . _onTypesInstallerInitializationFailed . fire ( ( event as Proto . TypesInstallerInitializationFailedEvent ) . body ) ;
1012
- break ;
1012
+ return ;
1013
1013
1014
1014
case EventName . surveyReady :
1015
1015
this . _onSurveyReady . fire ( ( event as Proto . SurveyReadyEvent ) . body ) ;
1016
- break ;
1016
+ return ;
1017
1017
1018
1018
case EventName . projectLoadingStart :
1019
1019
this . loadingIndicator . startedLoadingProject ( ( event as Proto . ProjectLoadingStartEvent ) . body . projectName ) ;
1020
- break ;
1020
+ return ;
1021
1021
1022
1022
case EventName . projectLoadingFinish :
1023
1023
this . loadingIndicator . finishedLoadingProject ( ( event as Proto . ProjectLoadingFinishEvent ) . body . projectName ) ;
1024
- break ;
1024
+ return ;
1025
+
1026
+ case EventName . createDirectoryWatcher : {
1027
+ const path = ( event . body as Proto . CreateDirectoryWatcherEventBody ) . path ;
1028
+ if ( path . startsWith ( inMemoryResourcePrefix ) ) {
1029
+ return ;
1030
+ }
1025
1031
1026
- case EventName . createDirectoryWatcher :
1027
1032
this . createFileSystemWatcher (
1028
1033
( event . body as Proto . CreateDirectoryWatcherEventBody ) . id ,
1029
1034
new vscode . RelativePattern (
1030
- vscode . Uri . file ( ( event . body as Proto . CreateDirectoryWatcherEventBody ) . path ) ,
1035
+ vscode . Uri . file ( path ) ,
1031
1036
( event . body as Proto . CreateDirectoryWatcherEventBody ) . recursive ? '**' : '*'
1032
1037
) ,
1033
1038
( event . body as Proto . CreateDirectoryWatcherEventBody ) . ignoreUpdate
1034
1039
) ;
1035
- break ;
1040
+ return ;
1041
+ }
1042
+ case EventName . createFileWatcher : {
1043
+ const path = ( event . body as Proto . CreateFileWatcherEventBody ) . path ;
1044
+ if ( path . startsWith ( inMemoryResourcePrefix ) ) {
1045
+ return ;
1046
+ }
1036
1047
1037
- case EventName . createFileWatcher :
1038
1048
this . createFileSystemWatcher (
1039
1049
( event . body as Proto . CreateFileWatcherEventBody ) . id ,
1040
1050
new vscode . RelativePattern (
1041
- vscode . Uri . file ( ( event . body as Proto . CreateFileWatcherEventBody ) . path ) ,
1051
+ vscode . Uri . file ( path ) ,
1042
1052
'*'
1043
1053
)
1044
1054
) ;
1045
- break ;
1046
-
1055
+ return ;
1056
+ }
1047
1057
case EventName . closeFileWatcher :
1048
1058
this . closeFileSystemWatcher ( event . body . id ) ;
1049
- break ;
1059
+ return ;
1050
1060
1051
1061
case EventName . requestCompleted : {
1052
1062
// @ts -expect-error until ts 5.6
@@ -1063,7 +1073,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
1063
1073
} )
1064
1074
) ;
1065
1075
}
1066
- break ;
1076
+ return ;
1067
1077
}
1068
1078
}
1069
1079
}
@@ -1148,13 +1158,9 @@ export default class TypeScriptServiceClient extends Disposable implements IType
1148
1158
this . watches . set ( id , disposable ) ;
1149
1159
}
1150
1160
1151
- private closeFileSystemWatcher (
1152
- id : number ,
1153
- ) {
1161
+ private closeFileSystemWatcher ( id : number ) {
1154
1162
const existing = this . watches . get ( id ) ;
1155
- if ( existing ) {
1156
- existing . dispose ( ) ;
1157
- }
1163
+ existing ?. dispose ( ) ;
1158
1164
}
1159
1165
1160
1166
private dispatchTelemetryEvent ( telemetryData : Proto . TelemetryEventBody ) : void {
0 commit comments