Skip to content
Permalink
Browse files
Remove unused defaultWatchFileKind method since useFsEvents is defaul…
…t for tsserver and tsc (#51044)
  • Loading branch information
sheetalkamat committed Oct 4, 2022
1 parent 8af9a93 commit fc5e72b92cb8ea13c5e0f2cfc35d8b2cbfd1fe36
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 178 deletions.
@@ -854,7 +854,6 @@ namespace ts {
tscWatchFile: string | undefined;
useNonPollingWatchers?: boolean;
tscWatchDirectory: string | undefined;
defaultWatchFileKind: System["defaultWatchFileKind"];
inodeWatching: boolean;
sysLog: (s: string) => void;
}
@@ -875,7 +874,6 @@ namespace ts {
tscWatchFile,
useNonPollingWatchers,
tscWatchDirectory,
defaultWatchFileKind,
inodeWatching,
sysLog,
}: CreateSystemWatchFunctions): { watchFile: HostWatchFile; watchDirectory: HostWatchDirectory; } {
@@ -953,8 +951,8 @@ namespace ts {
return useNonPollingWatchers ?
// Use notifications from FS to watch with falling back to fs.watchFile
generateWatchFileOptions(WatchFileKind.UseFsEventsOnParentDirectory, PollingWatchKind.PriorityInterval, options) :
// Default to do not use fixed polling interval
{ watchFile: defaultWatchFileKind?.() || WatchFileKind.UseFsEvents };
// Default to using fs events
{ watchFile: WatchFileKind.UseFsEvents };
}
}

@@ -1380,7 +1378,6 @@ namespace ts {
base64encode?(input: string): string;
/*@internal*/ bufferFrom?(input: string, encoding?: string): Buffer;
/*@internal*/ require?(baseDir: string, moduleName: string): RequireResult;
/*@internal*/ defaultWatchFileKind?(): WatchFileKind | undefined;

// For testing
/*@internal*/ now?(): Date;
@@ -1473,7 +1470,6 @@ namespace ts {
tscWatchFile: process.env.TSC_WATCHFILE,
useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
defaultWatchFileKind: () => sys!.defaultWatchFileKind?.(),
inodeWatching: isLinuxOrMacOs,
sysLog,
});
@@ -350,7 +350,6 @@ interface Array<T> { length: number; [n: number]: T; }`
private readonly executingFilePath: string;
private readonly currentDirectory: string;
public require: ((initialPath: string, moduleName: string) => RequireResult) | undefined;
public defaultWatchFileKind?: () => WatchFileKind | undefined;
public storeFilesChangingSignatureDuringEmit = true;
watchFile: HostWatchFile;
private inodeWatching: boolean | undefined;
@@ -398,7 +397,6 @@ interface Array<T> { length: number; [n: number]: T; }`
realpath: this.realpath.bind(this),
tscWatchFile,
tscWatchDirectory,
defaultWatchFileKind: () => this.defaultWatchFileKind?.(),
inodeWatching: !!this.inodeWatching,
sysLog: s => this.write(s + this.newLine),
});
@@ -120,36 +120,6 @@ namespace ts.tscWatch {
]
});

verifyTscWatch({
scenario,
subScenario: "watchFile/setting default as fixed chunk size watch file works",
commandLineArgs: ["-w", "-p", "/a/b/tsconfig.json"],
sys: () => {
const configFile: File = {
path: "/a/b/tsconfig.json",
content: "{}"
};
const files = [libFile, commonFile1, commonFile2, configFile];
const sys = createWatchedSystem(files);
sys.defaultWatchFileKind = () => WatchFileKind.FixedChunkSizePolling;
return sys;
},
changes: [
{
caption: "Make change to file but should detect as changed and schedule program update",
// Make a change to file
change: sys => sys.writeFile(commonFile1.path, "var zz30 = 100;"),
timeouts: checkSingleTimeoutQueueLengthAndRun,
},
{
caption: "Callbacks: queue and scheduled program update",
change: noop,
// Callbacks: scheduled program update and queue for the polling
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2),
},
]
});

describe("tsc-watch when watchDirectories implementation", () => {
function verifyRenamingFileInSubFolder(subScenario: string, tscWatchDirectory: Tsc_WatchDirectory) {
const projectFolder = "/a/username/project";

This file was deleted.

0 comments on commit fc5e72b

Please sign in to comment.