Skip to content

Commit 10a7b4e

Browse files
committed
Use fs events as default watching
1 parent 956ee00 commit 10a7b4e

File tree

365 files changed

+10153
-10114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

365 files changed

+10153
-10114
lines changed

src/compiler/sys.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ namespace ts {
968968
// Use notifications from FS to watch with falling back to fs.watchFile
969969
generateWatchFileOptions(WatchFileKind.UseFsEventsOnParentDirectory, PollingWatchKind.PriorityInterval, options) :
970970
// Default to do not use fixed polling interval
971-
{ watchFile: defaultWatchFileKind?.() || WatchFileKind.FixedPollingInterval };
971+
{ watchFile: defaultWatchFileKind?.() || WatchFileKind.UseFsEvents };
972972
}
973973
}
974974

src/tsserver/nodeServer.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -247,20 +247,6 @@ namespace ts.server {
247247

248248
// Override sys.write because fs.writeSync is not reliable on Node 4
249249
sys.write = (s: string) => writeMessage(sys.bufferFrom!(s, "utf8") as globalThis.Buffer);
250-
// REVIEW: for now this implementation uses polling.
251-
// The advantage of polling is that it works reliably
252-
// on all os and with network mounted files.
253-
// For 90 referenced files, the average time to detect
254-
// changes is 2*msInterval (by default 5 seconds).
255-
// The overhead of this is .04 percent (1/2500) with
256-
// average pause of < 1 millisecond (and max
257-
// pause less than 1.5 milliseconds); question is
258-
// do we anticipate reference sets in the 100s and
259-
// do we care about waiting 10-20 seconds to detect
260-
// changes for large reference sets? If so, do we want
261-
// to increase the chunk size or decrease the interval
262-
// time dynamically to match the large reference set?
263-
sys.defaultWatchFileKind = () => WatchFileKind.FixedChunkSizePolling;
264250

265251
/* eslint-disable no-restricted-globals */
266252
sys.setTimeout = setTimeout;

tests/baselines/reference/tsbuildWatch/configFileErrors/reports-syntax-errors-in-config-file.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ No cached semantic diagnostics in the builder::
5757
No shapes updated in the builder::
5858

5959
PolledWatches::
60+
61+
FsWatches::
6062
/user/username/projects/myproject/tsconfig.json:
61-
{"pollingInterval":250}
63+
{}
6264
/user/username/projects/myproject/a.ts:
63-
{"pollingInterval":250}
65+
{}
6466
/user/username/projects/myproject/b.ts:
65-
{"pollingInterval":250}
66-
67-
FsWatches::
67+
{}
6868

6969
FsWatchesRecursive::
7070

@@ -151,14 +151,14 @@ No cached semantic diagnostics in the builder::
151151
No shapes updated in the builder::
152152

153153
PolledWatches::
154+
155+
FsWatches::
154156
/user/username/projects/myproject/tsconfig.json:
155-
{"pollingInterval":250}
157+
{}
156158
/user/username/projects/myproject/a.ts:
157-
{"pollingInterval":250}
159+
{}
158160
/user/username/projects/myproject/b.ts:
159-
{"pollingInterval":250}
160-
161-
FsWatches::
161+
{}
162162

163163
FsWatchesRecursive::
164164

@@ -198,14 +198,14 @@ No cached semantic diagnostics in the builder::
198198
No shapes updated in the builder::
199199

200200
PolledWatches::
201+
202+
FsWatches::
201203
/user/username/projects/myproject/tsconfig.json:
202-
{"pollingInterval":250}
204+
{}
203205
/user/username/projects/myproject/a.ts:
204-
{"pollingInterval":250}
206+
{}
205207
/user/username/projects/myproject/b.ts:
206-
{"pollingInterval":250}
207-
208-
FsWatches::
208+
{}
209209

210210
FsWatchesRecursive::
211211

@@ -243,14 +243,14 @@ No cached semantic diagnostics in the builder::
243243
No shapes updated in the builder::
244244

245245
PolledWatches::
246+
247+
FsWatches::
246248
/user/username/projects/myproject/tsconfig.json:
247-
{"pollingInterval":250}
249+
{}
248250
/user/username/projects/myproject/a.ts:
249-
{"pollingInterval":250}
251+
{}
250252
/user/username/projects/myproject/b.ts:
251-
{"pollingInterval":250}
252-
253-
FsWatches::
253+
{}
254254

255255
FsWatchesRecursive::
256256

@@ -291,14 +291,14 @@ Shape signatures in builder refreshed for::
291291
/user/username/projects/myproject/b.ts (computed .d.ts)
292292

293293
PolledWatches::
294+
295+
FsWatches::
294296
/user/username/projects/myproject/tsconfig.json:
295-
{"pollingInterval":250}
297+
{}
296298
/user/username/projects/myproject/a.ts:
297-
{"pollingInterval":250}
299+
{}
298300
/user/username/projects/myproject/b.ts:
299-
{"pollingInterval":250}
300-
301-
FsWatches::
301+
{}
302302

303303
FsWatchesRecursive::
304304

tests/baselines/reference/tsbuildWatch/demo/updates-with-bad-reference.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -246,30 +246,30 @@ Shape signatures in builder refreshed for::
246246
/user/username/projects/demo/core/utilities.ts (used version)
247247

248248
PolledWatches::
249+
/user/username/projects/demo/animals/package.json:
250+
{"pollingInterval":2000}
251+
252+
FsWatches::
249253
/user/username/projects/demo/core/tsconfig.json:
250-
{"pollingInterval":250}
254+
{}
251255
/user/username/projects/demo/tsconfig-base.json:
252-
{"pollingInterval":250}
256+
{}
253257
/user/username/projects/demo/core/utilities.ts:
254-
{"pollingInterval":250}
255-
/user/username/projects/demo/animals/package.json:
256-
{"pollingInterval":250}
258+
{}
257259
/user/username/projects/demo/animals/tsconfig.json:
258-
{"pollingInterval":250}
260+
{}
259261
/user/username/projects/demo/animals/animal.ts:
260-
{"pollingInterval":250}
262+
{}
261263
/user/username/projects/demo/animals/dog.ts:
262-
{"pollingInterval":250}
264+
{}
263265
/user/username/projects/demo/animals/index.ts:
264-
{"pollingInterval":250}
266+
{}
265267
/user/username/projects/demo/zoo/tsconfig.json:
266-
{"pollingInterval":250}
268+
{}
267269
/user/username/projects/demo/zoo/zoo.ts:
268-
{"pollingInterval":250}
270+
{}
269271
/user/username/projects/demo/tsconfig.json:
270-
{"pollingInterval":250}
271-
272-
FsWatches::
272+
{}
273273

274274
FsWatchesRecursive::
275275
/user/username/projects/demo/core:
@@ -522,30 +522,30 @@ Shape signatures in builder refreshed for::
522522
/user/username/projects/demo/animals/index.ts (computed .d.ts)
523523

524524
PolledWatches::
525+
/user/username/projects/demo/animals/package.json:
526+
{"pollingInterval":2000}
527+
528+
FsWatches::
525529
/user/username/projects/demo/core/tsconfig.json:
526-
{"pollingInterval":250}
530+
{}
527531
/user/username/projects/demo/tsconfig-base.json:
528-
{"pollingInterval":250}
532+
{}
529533
/user/username/projects/demo/core/utilities.ts:
530-
{"pollingInterval":250}
531-
/user/username/projects/demo/animals/package.json:
532-
{"pollingInterval":250}
534+
{}
533535
/user/username/projects/demo/animals/tsconfig.json:
534-
{"pollingInterval":250}
536+
{}
535537
/user/username/projects/demo/animals/animal.ts:
536-
{"pollingInterval":250}
538+
{}
537539
/user/username/projects/demo/animals/dog.ts:
538-
{"pollingInterval":250}
540+
{}
539541
/user/username/projects/demo/animals/index.ts:
540-
{"pollingInterval":250}
542+
{}
541543
/user/username/projects/demo/zoo/tsconfig.json:
542-
{"pollingInterval":250}
544+
{}
543545
/user/username/projects/demo/zoo/zoo.ts:
544-
{"pollingInterval":250}
546+
{}
545547
/user/username/projects/demo/tsconfig.json:
546-
{"pollingInterval":250}
547-
548-
FsWatches::
548+
{}
549549

550550
FsWatchesRecursive::
551551
/user/username/projects/demo/core:

tests/baselines/reference/tsbuildWatch/demo/updates-with-circular-reference.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -168,28 +168,28 @@ Output::
168168

169169

170170
PolledWatches::
171+
172+
FsWatches::
171173
/user/username/projects/demo/animals/tsconfig.json:
172-
{"pollingInterval":250}
174+
{}
173175
/user/username/projects/demo/tsconfig-base.json:
174-
{"pollingInterval":250}
176+
{}
175177
/user/username/projects/demo/animals/animal.ts:
176-
{"pollingInterval":250}
178+
{}
177179
/user/username/projects/demo/animals/dog.ts:
178-
{"pollingInterval":250}
180+
{}
179181
/user/username/projects/demo/animals/index.ts:
180-
{"pollingInterval":250}
182+
{}
181183
/user/username/projects/demo/zoo/tsconfig.json:
182-
{"pollingInterval":250}
184+
{}
183185
/user/username/projects/demo/zoo/zoo.ts:
184-
{"pollingInterval":250}
186+
{}
185187
/user/username/projects/demo/core/tsconfig.json:
186-
{"pollingInterval":250}
188+
{}
187189
/user/username/projects/demo/core/utilities.ts:
188-
{"pollingInterval":250}
190+
{}
189191
/user/username/projects/demo/tsconfig.json:
190-
{"pollingInterval":250}
191-
192-
FsWatches::
192+
{}
193193

194194
FsWatchesRecursive::
195195
/user/username/projects/demo/animals:
@@ -299,28 +299,28 @@ Shape signatures in builder refreshed for::
299299
/user/username/projects/demo/zoo/zoo.ts (computed .d.ts during emit)
300300

301301
PolledWatches::
302+
303+
FsWatches::
302304
/user/username/projects/demo/animals/tsconfig.json:
303-
{"pollingInterval":250}
305+
{}
304306
/user/username/projects/demo/tsconfig-base.json:
305-
{"pollingInterval":250}
307+
{}
306308
/user/username/projects/demo/animals/animal.ts:
307-
{"pollingInterval":250}
309+
{}
308310
/user/username/projects/demo/animals/dog.ts:
309-
{"pollingInterval":250}
311+
{}
310312
/user/username/projects/demo/animals/index.ts:
311-
{"pollingInterval":250}
313+
{}
312314
/user/username/projects/demo/zoo/tsconfig.json:
313-
{"pollingInterval":250}
315+
{}
314316
/user/username/projects/demo/zoo/zoo.ts:
315-
{"pollingInterval":250}
317+
{}
316318
/user/username/projects/demo/core/tsconfig.json:
317-
{"pollingInterval":250}
319+
{}
318320
/user/username/projects/demo/core/utilities.ts:
319-
{"pollingInterval":250}
321+
{}
320322
/user/username/projects/demo/tsconfig.json:
321-
{"pollingInterval":250}
322-
323-
FsWatches::
323+
{}
324324

325325
FsWatchesRecursive::
326326
/user/username/projects/demo/animals:

tests/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -149,22 +149,22 @@ Shape signatures in builder refreshed for::
149149
/user/username/projects/myproject/packages/pkg1/index.ts (used version)
150150

151151
PolledWatches::
152+
153+
FsWatches::
152154
/user/username/projects/myproject/packages/pkg2/tsconfig.json:
153-
{"pollingInterval":250}
155+
{}
154156
/user/username/projects/myproject/packages/pkg2/const.ts:
155-
{"pollingInterval":250}
157+
{}
156158
/user/username/projects/myproject/packages/pkg2/index.ts:
157-
{"pollingInterval":250}
159+
{}
158160
/user/username/projects/myproject/packages/pkg2/other.ts:
159-
{"pollingInterval":250}
161+
{}
160162
/user/username/projects/myproject/packages/pkg1/tsconfig.json:
161-
{"pollingInterval":250}
163+
{}
162164
/user/username/projects/myproject/packages/pkg1/index.ts:
163-
{"pollingInterval":250}
165+
{}
164166
/user/username/projects/myproject/packages/pkg2/package.json:
165-
{"pollingInterval":250}
166-
167-
FsWatches::
167+
{}
168168

169169
FsWatchesRecursive::
170170
/user/username/projects/myproject/packages/pkg2:
@@ -337,22 +337,22 @@ Shape signatures in builder refreshed for::
337337
/user/username/projects/myproject/packages/pkg1/index.ts (computed .d.ts)
338338

339339
PolledWatches::
340+
341+
FsWatches::
340342
/user/username/projects/myproject/packages/pkg2/tsconfig.json:
341-
{"pollingInterval":250}
343+
{}
342344
/user/username/projects/myproject/packages/pkg2/const.ts:
343-
{"pollingInterval":250}
345+
{}
344346
/user/username/projects/myproject/packages/pkg2/index.ts:
345-
{"pollingInterval":250}
347+
{}
346348
/user/username/projects/myproject/packages/pkg2/other.ts:
347-
{"pollingInterval":250}
349+
{}
348350
/user/username/projects/myproject/packages/pkg1/tsconfig.json:
349-
{"pollingInterval":250}
351+
{}
350352
/user/username/projects/myproject/packages/pkg1/index.ts:
351-
{"pollingInterval":250}
353+
{}
352354
/user/username/projects/myproject/packages/pkg2/package.json:
353-
{"pollingInterval":250}
354-
355-
FsWatches::
355+
{}
356356

357357
FsWatchesRecursive::
358358
/user/username/projects/myproject/packages/pkg2:
@@ -439,22 +439,22 @@ Shape signatures in builder refreshed for::
439439
/user/username/projects/myproject/packages/pkg1/index.ts (computed .d.ts)
440440

441441
PolledWatches::
442+
443+
FsWatches::
442444
/user/username/projects/myproject/packages/pkg2/tsconfig.json:
443-
{"pollingInterval":250}
445+
{}
444446
/user/username/projects/myproject/packages/pkg2/const.ts:
445-
{"pollingInterval":250}
447+
{}
446448
/user/username/projects/myproject/packages/pkg2/index.ts:
447-
{"pollingInterval":250}
449+
{}
448450
/user/username/projects/myproject/packages/pkg2/other.ts:
449-
{"pollingInterval":250}
451+
{}
450452
/user/username/projects/myproject/packages/pkg1/tsconfig.json:
451-
{"pollingInterval":250}
453+
{}
452454
/user/username/projects/myproject/packages/pkg1/index.ts:
453-
{"pollingInterval":250}
455+
{}
454456
/user/username/projects/myproject/packages/pkg2/package.json:
455-
{"pollingInterval":250}
456-
457-
FsWatches::
457+
{}
458458

459459
FsWatchesRecursive::
460460
/user/username/projects/myproject/packages/pkg2:

0 commit comments

Comments
 (0)