mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-15 16:53:31 -06:00
Remove unused defaultWatchFileKind method since useFsEvents is default for tsserver and tsc (#51044)
This commit is contained in:
parent
8af9a936b5
commit
fc5e72b92c
@ -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";
|
||||
|
||||
@ -1,140 +0,0 @@
|
||||
Input::
|
||||
//// [/a/lib/lib.d.ts]
|
||||
/// <reference no-default-lib="true"/>
|
||||
interface Boolean {}
|
||||
interface Function {}
|
||||
interface CallableFunction {}
|
||||
interface NewableFunction {}
|
||||
interface IArguments {}
|
||||
interface Number { toExponential: any; }
|
||||
interface Object {}
|
||||
interface RegExp {}
|
||||
interface String { charAt: any; }
|
||||
interface Array<T> { length: number; [n: number]: T; }
|
||||
|
||||
//// [/a/b/commonFile1.ts]
|
||||
let x = 1
|
||||
|
||||
//// [/a/b/commonFile2.ts]
|
||||
let y = 1
|
||||
|
||||
//// [/a/b/tsconfig.json]
|
||||
{}
|
||||
|
||||
|
||||
/a/lib/tsc.js -w -p /a/b/tsconfig.json
|
||||
Output::
|
||||
>> Screen clear
|
||||
[[90m12:00:17 AM[0m] Starting compilation in watch mode...
|
||||
|
||||
[[90m12:00:22 AM[0m] Found 0 errors. Watching for file changes.
|
||||
|
||||
|
||||
|
||||
Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"]
|
||||
Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"}
|
||||
Program structureReused: Not
|
||||
Program files::
|
||||
/a/lib/lib.d.ts
|
||||
/a/b/commonFile1.ts
|
||||
/a/b/commonFile2.ts
|
||||
|
||||
Semantic diagnostics in builder refreshed for::
|
||||
/a/lib/lib.d.ts
|
||||
/a/b/commonFile1.ts
|
||||
/a/b/commonFile2.ts
|
||||
|
||||
Shape signatures in builder refreshed for::
|
||||
/a/lib/lib.d.ts (used version)
|
||||
/a/b/commonfile1.ts (used version)
|
||||
/a/b/commonfile2.ts (used version)
|
||||
|
||||
PolledWatches::
|
||||
/a/b/node_modules/@types:
|
||||
{"pollingInterval":500}
|
||||
|
||||
FsWatches::
|
||||
|
||||
FsWatchesRecursive::
|
||||
/a/b:
|
||||
{}
|
||||
|
||||
exitCode:: ExitStatus.undefined
|
||||
|
||||
//// [/a/b/commonFile1.js]
|
||||
var x = 1;
|
||||
|
||||
|
||||
//// [/a/b/commonFile2.js]
|
||||
var y = 1;
|
||||
|
||||
|
||||
|
||||
Change:: Make change to file but should detect as changed and schedule program update
|
||||
|
||||
Input::
|
||||
//// [/a/b/commonFile1.ts]
|
||||
var zz30 = 100;
|
||||
|
||||
|
||||
Output::
|
||||
|
||||
PolledWatches::
|
||||
/a/b/node_modules/@types:
|
||||
{"pollingInterval":500}
|
||||
|
||||
FsWatches::
|
||||
|
||||
FsWatchesRecursive::
|
||||
/a/b:
|
||||
{}
|
||||
|
||||
exitCode:: ExitStatus.undefined
|
||||
|
||||
|
||||
Change:: Callbacks: queue and scheduled program update
|
||||
|
||||
Input::
|
||||
|
||||
Output::
|
||||
>> Screen clear
|
||||
[[90m12:00:26 AM[0m] File change detected. Starting incremental compilation...
|
||||
|
||||
[[90m12:00:33 AM[0m] Found 0 errors. Watching for file changes.
|
||||
|
||||
|
||||
|
||||
Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"]
|
||||
Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"}
|
||||
Program structureReused: Completely
|
||||
Program files::
|
||||
/a/lib/lib.d.ts
|
||||
/a/b/commonFile1.ts
|
||||
/a/b/commonFile2.ts
|
||||
|
||||
Semantic diagnostics in builder refreshed for::
|
||||
/a/lib/lib.d.ts
|
||||
/a/b/commonFile1.ts
|
||||
/a/b/commonFile2.ts
|
||||
|
||||
Shape signatures in builder refreshed for::
|
||||
/a/b/commonfile1.ts (computed .d.ts)
|
||||
/a/b/commonfile2.ts (computed .d.ts)
|
||||
|
||||
PolledWatches::
|
||||
/a/b/node_modules/@types:
|
||||
{"pollingInterval":500}
|
||||
|
||||
FsWatches::
|
||||
|
||||
FsWatchesRecursive::
|
||||
/a/b:
|
||||
{}
|
||||
|
||||
exitCode:: ExitStatus.undefined
|
||||
|
||||
//// [/a/b/commonFile1.js]
|
||||
var zz30 = 100;
|
||||
|
||||
|
||||
//// [/a/b/commonFile2.js] file written with same contents
|
||||
Loading…
x
Reference in New Issue
Block a user