@@ -246,8 +246,12 @@ interface Array<T> {}`
246246 }
247247
248248 export interface ReloadWatchInvokeOptions {
249+ /** Invokes the directory watcher for the parent instead of the file changed */
249250 invokeDirectoryWatcherInsteadOfFileChanged : boolean ;
251+ /** When new file is created, do not invoke watches for it */
250252 ignoreWatchInvokedWithTriggerAsFileCreate : boolean ;
253+ /** Invoke the file delete, followed by create instead of file changed */
254+ invokeFileDeleteCreateAsPartInsteadOfChange : boolean ;
251255 }
252256
253257 export class TestServerHost implements server . ServerHost , FormatDiagnosticsHost , ModuleResolutionHost {
@@ -315,12 +319,18 @@ interface Array<T> {}`
315319 if ( isString ( fileOrDirectory . content ) ) {
316320 // Update file
317321 if ( currentEntry . content !== fileOrDirectory . content ) {
318- currentEntry . content = fileOrDirectory . content ;
319- if ( options && options . invokeDirectoryWatcherInsteadOfFileChanged ) {
320- this . invokeDirectoryWatcher ( getDirectoryPath ( currentEntry . fullPath ) , currentEntry . fullPath ) ;
322+ if ( options && options . invokeFileDeleteCreateAsPartInsteadOfChange ) {
323+ this . removeFileOrFolder ( currentEntry , returnFalse ) ;
324+ this . ensureFileOrFolder ( fileOrDirectory ) ;
321325 }
322326 else {
323- this . invokeFileWatcher ( currentEntry . fullPath , FileWatcherEventKind . Changed ) ;
327+ currentEntry . content = fileOrDirectory . content ;
328+ if ( options && options . invokeDirectoryWatcherInsteadOfFileChanged ) {
329+ this . invokeDirectoryWatcher ( getDirectoryPath ( currentEntry . fullPath ) , currentEntry . fullPath ) ;
330+ }
331+ else {
332+ this . invokeFileWatcher ( currentEntry . fullPath , FileWatcherEventKind . Changed ) ;
333+ }
324334 }
325335 }
326336 }
0 commit comments