Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused defaultWatchFileKind method since useFsEvents is default for tsserver and tsc #51044

Merged
merged 1 commit into from Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/compiler/sys.ts
Expand Up @@ -854,7 +854,6 @@ namespace ts {
tscWatchFile: string | undefined;
useNonPollingWatchers?: boolean;
tscWatchDirectory: string | undefined;
defaultWatchFileKind: System["defaultWatchFileKind"];
inodeWatching: boolean;
sysLog: (s: string) => void;
}
Expand All @@ -875,7 +874,6 @@ namespace ts {
tscWatchFile,
useNonPollingWatchers,
tscWatchDirectory,
defaultWatchFileKind,
inodeWatching,
sysLog,
}: CreateSystemWatchFunctions): { watchFile: HostWatchFile; watchDirectory: HostWatchDirectory; } {
Expand Down Expand Up @@ -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 };
}
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
});
Expand Down
2 changes: 0 additions & 2 deletions src/harness/virtualFileSystemWithWatch.ts
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
});
Expand Down
30 changes: 0 additions & 30 deletions src/testRunner/unittests/tscWatch/watchEnvironment.ts
Expand Up @@ -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";
Expand Down

This file was deleted.