Skip to content

Commit fc5e72b

Browse files
authoredOct 4, 2022
Remove unused defaultWatchFileKind method since useFsEvents is default for tsserver and tsc (#51044)
1 parent 8af9a93 commit fc5e72b

File tree

4 files changed

+2
-178
lines changed

4 files changed

+2
-178
lines changed
 

‎src/compiler/sys.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,6 @@ namespace ts {
854854
tscWatchFile: string | undefined;
855855
useNonPollingWatchers?: boolean;
856856
tscWatchDirectory: string | undefined;
857-
defaultWatchFileKind: System["defaultWatchFileKind"];
858857
inodeWatching: boolean;
859858
sysLog: (s: string) => void;
860859
}
@@ -875,7 +874,6 @@ namespace ts {
875874
tscWatchFile,
876875
useNonPollingWatchers,
877876
tscWatchDirectory,
878-
defaultWatchFileKind,
879877
inodeWatching,
880878
sysLog,
881879
}: CreateSystemWatchFunctions): { watchFile: HostWatchFile; watchDirectory: HostWatchDirectory; } {
@@ -953,8 +951,8 @@ namespace ts {
953951
return useNonPollingWatchers ?
954952
// Use notifications from FS to watch with falling back to fs.watchFile
955953
generateWatchFileOptions(WatchFileKind.UseFsEventsOnParentDirectory, PollingWatchKind.PriorityInterval, options) :
956-
// Default to do not use fixed polling interval
957-
{ watchFile: defaultWatchFileKind?.() || WatchFileKind.UseFsEvents };
954+
// Default to using fs events
955+
{ watchFile: WatchFileKind.UseFsEvents };
958956
}
959957
}
960958

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

13851382
// For testing
13861383
/*@internal*/ now?(): Date;
@@ -1473,7 +1470,6 @@ namespace ts {
14731470
tscWatchFile: process.env.TSC_WATCHFILE,
14741471
useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
14751472
tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
1476-
defaultWatchFileKind: () => sys!.defaultWatchFileKind?.(),
14771473
inodeWatching: isLinuxOrMacOs,
14781474
sysLog,
14791475
});

‎src/harness/virtualFileSystemWithWatch.ts

-2
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ interface Array<T> { length: number; [n: number]: T; }`
350350
private readonly executingFilePath: string;
351351
private readonly currentDirectory: string;
352352
public require: ((initialPath: string, moduleName: string) => RequireResult) | undefined;
353-
public defaultWatchFileKind?: () => WatchFileKind | undefined;
354353
public storeFilesChangingSignatureDuringEmit = true;
355354
watchFile: HostWatchFile;
356355
private inodeWatching: boolean | undefined;
@@ -398,7 +397,6 @@ interface Array<T> { length: number; [n: number]: T; }`
398397
realpath: this.realpath.bind(this),
399398
tscWatchFile,
400399
tscWatchDirectory,
401-
defaultWatchFileKind: () => this.defaultWatchFileKind?.(),
402400
inodeWatching: !!this.inodeWatching,
403401
sysLog: s => this.write(s + this.newLine),
404402
});

‎src/testRunner/unittests/tscWatch/watchEnvironment.ts

-30
Original file line numberDiff line numberDiff line change
@@ -120,36 +120,6 @@ namespace ts.tscWatch {
120120
]
121121
});
122122

123-
verifyTscWatch({
124-
scenario,
125-
subScenario: "watchFile/setting default as fixed chunk size watch file works",
126-
commandLineArgs: ["-w", "-p", "/a/b/tsconfig.json"],
127-
sys: () => {
128-
const configFile: File = {
129-
path: "/a/b/tsconfig.json",
130-
content: "{}"
131-
};
132-
const files = [libFile, commonFile1, commonFile2, configFile];
133-
const sys = createWatchedSystem(files);
134-
sys.defaultWatchFileKind = () => WatchFileKind.FixedChunkSizePolling;
135-
return sys;
136-
},
137-
changes: [
138-
{
139-
caption: "Make change to file but should detect as changed and schedule program update",
140-
// Make a change to file
141-
change: sys => sys.writeFile(commonFile1.path, "var zz30 = 100;"),
142-
timeouts: checkSingleTimeoutQueueLengthAndRun,
143-
},
144-
{
145-
caption: "Callbacks: queue and scheduled program update",
146-
change: noop,
147-
// Callbacks: scheduled program update and queue for the polling
148-
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2),
149-
},
150-
]
151-
});
152-
153123
describe("tsc-watch when watchDirectories implementation", () => {
154124
function verifyRenamingFileInSubFolder(subScenario: string, tscWatchDirectory: Tsc_WatchDirectory) {
155125
const projectFolder = "/a/username/project";

‎tests/baselines/reference/tscWatch/watchEnvironment/watchFile/setting-default-as-fixed-chunk-size-watch-file-works.js

-140
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.