File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -233,13 +233,14 @@ namespace ts {
233
233
}
234
234
235
235
export const noopFileWatcher : FileWatcher = { close : noop } ;
236
+ export const returnNoopFileWatcher = ( ) => noopFileWatcher ;
236
237
237
238
export function createWatchHost ( system = sys , reportWatchStatus ?: WatchStatusReporter ) : WatchHost {
238
239
const onWatchStatusChange = reportWatchStatus || createWatchStatusReporter ( system ) ;
239
240
return {
240
241
onWatchStatusChange,
241
- watchFile : maybeBind ( system , system . watchFile ) || ( ( ) => noopFileWatcher ) ,
242
- watchDirectory : maybeBind ( system , system . watchDirectory ) || ( ( ) => noopFileWatcher ) ,
242
+ watchFile : maybeBind ( system , system . watchFile ) || returnNoopFileWatcher ,
243
+ watchDirectory : maybeBind ( system , system . watchDirectory ) || returnNoopFileWatcher ,
243
244
setTimeout : maybeBind ( system , system . setTimeout ) || noop ,
244
245
clearTimeout : maybeBind ( system , system . clearTimeout ) || noop
245
246
} ;
Original file line number Diff line number Diff line change @@ -724,7 +724,13 @@ namespace ts.server {
724
724
const watchLogLevel = this . logger . hasLevel ( LogLevel . verbose ) ? WatchLogLevel . Verbose :
725
725
this . logger . loggingEnabled ( ) ? WatchLogLevel . TriggerOnly : WatchLogLevel . None ;
726
726
const log : ( s : string ) => void = watchLogLevel !== WatchLogLevel . None ? ( s => this . logger . info ( s ) ) : noop ;
727
- this . watchFactory = getWatchFactory ( watchLogLevel , log , getDetailWatchInfo ) ;
727
+ this . watchFactory = this . syntaxOnly ?
728
+ {
729
+ watchFile : returnNoopFileWatcher ,
730
+ watchFilePath : returnNoopFileWatcher ,
731
+ watchDirectory : returnNoopFileWatcher ,
732
+ } :
733
+ getWatchFactory ( watchLogLevel , log , getDetailWatchInfo ) ;
728
734
}
729
735
730
736
toPath ( fileName : string ) {
Original file line number Diff line number Diff line change @@ -947,7 +947,7 @@ namespace ts.server {
947
947
948
948
// update builder only if language service is enabled
949
949
// otherwise tell it to drop its internal state
950
- if ( this . languageServiceEnabled ) {
950
+ if ( this . languageServiceEnabled && ! this . projectService . syntaxOnly ) {
951
951
// 1. no changes in structure, no changes in unresolved imports - do nothing
952
952
// 2. no changes in structure, unresolved imports were changed - collect unresolved imports for all files
953
953
// (can reuse cached imports for files that were not changed)
@@ -1070,7 +1070,7 @@ namespace ts.server {
1070
1070
}
1071
1071
1072
1072
// Watch the type locations that would be added to program as part of automatic type resolutions
1073
- if ( this . languageServiceEnabled ) {
1073
+ if ( this . languageServiceEnabled && ! this . projectService . syntaxOnly ) {
1074
1074
this . resolutionCache . updateTypeRootsWatch ( ) ;
1075
1075
}
1076
1076
}
You can’t perform that action at this time.
0 commit comments