From d8bf95ff108314fc343931abf7e593c6dd705c7c Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 29 Mar 2018 09:13:03 -0700 Subject: [PATCH] PR feedback --- src/compiler/sys.ts | 8 +++++--- src/harness/virtualFileSystemWithWatch.ts | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index b2818918af..8c2612155e 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -334,7 +334,7 @@ namespace ts { /*@internal*/ export interface RecursiveDirectoryWatcherHost { watchDirectory: HostWatchDirectory; - getAccessileSortedChildDirectories(path: string): ReadonlyArray; + getAccessibleSortedChildDirectories(path: string): ReadonlyArray; directoryExists(dir: string): boolean; filePathComparer: Comparer; realpath(s: string): string; @@ -393,8 +393,10 @@ namespace ts { function watchChildDirectories(parentDir: string, existingChildWatches: ChildWatches, callback: DirectoryWatcherCallback): ChildWatches { let newChildWatches: DirectoryWatcher[] | undefined; enumerateInsertsAndDeletes( - host.directoryExists(parentDir) ? mapDefined(host.getAccessileSortedChildDirectories(parentDir), child => { + host.directoryExists(parentDir) ? mapDefined(host.getAccessibleSortedChildDirectories(parentDir), child => { const childFullName = getNormalizedAbsolutePath(child, parentDir); + // Filter our the symbolic link directories since those arent included in recursive watch + // which is same behaviour when recursive: true is passed to fs.watch return host.filePathComparer(childFullName, host.realpath(childFullName)) === Comparison.EqualTo ? childFullName : undefined; }) : emptyArray, existingChildWatches, @@ -696,7 +698,7 @@ namespace ts { const watchDirectoryRecursively = createRecursiveDirectoryWatcher({ filePathComparer: useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive, directoryExists, - getAccessileSortedChildDirectories: path => getAccessibleFileSystemEntries(path).directories, + getAccessibleSortedChildDirectories: path => getAccessibleFileSystemEntries(path).directories, watchDirectory, realpath }); diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index 21f16ab579..81232fb63f 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -312,7 +312,7 @@ interface Array {}` const watchDirectory: HostWatchDirectory = (directory, cb) => this.watchFile(directory, () => cb(directory), PollingInterval.Medium); this.customRecursiveWatchDirectory = createRecursiveDirectoryWatcher({ directoryExists: path => this.directoryExists(path), - getAccessileSortedChildDirectories: path => this.getDirectories(path), + getAccessibleSortedChildDirectories: path => this.getDirectories(path), filePathComparer: this.useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive, watchDirectory, realpath: s => this.realpath(s) @@ -322,7 +322,7 @@ interface Array {}` const watchDirectory: HostWatchDirectory = (directory, cb) => this.watchDirectory(directory, fileName => cb(fileName), /*recursive*/ false); this.customRecursiveWatchDirectory = createRecursiveDirectoryWatcher({ directoryExists: path => this.directoryExists(path), - getAccessileSortedChildDirectories: path => this.getDirectories(path), + getAccessibleSortedChildDirectories: path => this.getDirectories(path), filePathComparer: this.useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive, watchDirectory, realpath: s => this.realpath(s) @@ -333,7 +333,7 @@ interface Array {}` const watchDirectory: HostWatchDirectory = (directory, cb) => watchFile(directory, () => cb(directory), PollingInterval.Medium); this.customRecursiveWatchDirectory = createRecursiveDirectoryWatcher({ directoryExists: path => this.directoryExists(path), - getAccessileSortedChildDirectories: path => this.getDirectories(path), + getAccessibleSortedChildDirectories: path => this.getDirectories(path), filePathComparer: this.useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive, watchDirectory, realpath: s => this.realpath(s)