Skip to content
  •  
  •  
  •  
Prev Previous commit
Next Next commit
Use fs events as default watching
  • Loading branch information
sheetalkamat committed Aug 18, 2022
commit 10a7b4e252f2d6554895a923c48435d7211d30a7
2 changes: 1 addition & 1 deletion src/compiler/sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ namespace ts {
// 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.FixedPollingInterval };
{ watchFile: defaultWatchFileKind?.() || WatchFileKind.UseFsEvents };
}
}

Expand Down
14 changes: 0 additions & 14 deletions src/tsserver/nodeServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,20 +247,6 @@ namespace ts.server {

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

/* eslint-disable no-restricted-globals */
sys.setTimeout = setTimeout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ No cached semantic diagnostics in the builder::
No shapes updated in the builder::

PolledWatches::

FsWatches::
/user/username/projects/myproject/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/myproject/a.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/b.ts:
{"pollingInterval":250}

FsWatches::
{}

FsWatchesRecursive::

Expand Down Expand Up @@ -151,14 +151,14 @@ No cached semantic diagnostics in the builder::
No shapes updated in the builder::

PolledWatches::

FsWatches::
/user/username/projects/myproject/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/myproject/a.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/b.ts:
{"pollingInterval":250}

FsWatches::
{}

FsWatchesRecursive::

Expand Down Expand Up @@ -198,14 +198,14 @@ No cached semantic diagnostics in the builder::
No shapes updated in the builder::

PolledWatches::

FsWatches::
/user/username/projects/myproject/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/myproject/a.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/b.ts:
{"pollingInterval":250}

FsWatches::
{}

FsWatchesRecursive::

Expand Down Expand Up @@ -243,14 +243,14 @@ No cached semantic diagnostics in the builder::
No shapes updated in the builder::

PolledWatches::

FsWatches::
/user/username/projects/myproject/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/myproject/a.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/b.ts:
{"pollingInterval":250}

FsWatches::
{}

FsWatchesRecursive::

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

PolledWatches::

FsWatches::
/user/username/projects/myproject/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/myproject/a.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/b.ts:
{"pollingInterval":250}

FsWatches::
{}

FsWatchesRecursive::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,30 +246,30 @@ Shape signatures in builder refreshed for::
/user/username/projects/demo/core/utilities.ts (used version)

PolledWatches::
/user/username/projects/demo/animals/package.json:
{"pollingInterval":2000}

FsWatches::
/user/username/projects/demo/core/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/tsconfig-base.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/core/utilities.ts:
{"pollingInterval":250}
/user/username/projects/demo/animals/package.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/animals/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/animals/animal.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/animals/dog.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/animals/index.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/zoo/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/zoo/zoo.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/tsconfig.json:
{"pollingInterval":250}

FsWatches::
{}

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

PolledWatches::
/user/username/projects/demo/animals/package.json:
{"pollingInterval":2000}

FsWatches::
/user/username/projects/demo/core/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/tsconfig-base.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/core/utilities.ts:
{"pollingInterval":250}
/user/username/projects/demo/animals/package.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/animals/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/animals/animal.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/animals/dog.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/animals/index.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/zoo/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/zoo/zoo.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/tsconfig.json:
{"pollingInterval":250}

FsWatches::
{}

FsWatchesRecursive::
/user/username/projects/demo/core:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,28 +168,28 @@ Output::


PolledWatches::

FsWatches::
/user/username/projects/demo/animals/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/tsconfig-base.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/animals/animal.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/animals/dog.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/animals/index.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/zoo/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/zoo/zoo.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/core/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/core/utilities.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/tsconfig.json:
{"pollingInterval":250}

FsWatches::
{}

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

PolledWatches::

FsWatches::
/user/username/projects/demo/animals/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/tsconfig-base.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/animals/animal.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/animals/dog.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/animals/index.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/zoo/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/zoo/zoo.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/core/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/demo/core/utilities.ts:
{"pollingInterval":250}
{}
/user/username/projects/demo/tsconfig.json:
{"pollingInterval":250}

FsWatches::
{}

FsWatchesRecursive::
/user/username/projects/demo/animals:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,22 @@ Shape signatures in builder refreshed for::
/user/username/projects/myproject/packages/pkg1/index.ts (used version)

PolledWatches::

FsWatches::
/user/username/projects/myproject/packages/pkg2/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg2/const.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg2/index.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg2/other.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg1/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg1/index.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg2/package.json:
{"pollingInterval":250}

FsWatches::
{}

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

PolledWatches::

FsWatches::
/user/username/projects/myproject/packages/pkg2/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg2/const.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg2/index.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg2/other.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg1/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg1/index.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg2/package.json:
{"pollingInterval":250}

FsWatches::
{}

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

PolledWatches::

FsWatches::
/user/username/projects/myproject/packages/pkg2/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg2/const.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg2/index.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg2/other.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg1/tsconfig.json:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg1/index.ts:
{"pollingInterval":250}
{}
/user/username/projects/myproject/packages/pkg2/package.json:
{"pollingInterval":250}

FsWatches::
{}

FsWatchesRecursive::
/user/username/projects/myproject/packages/pkg2:
Expand Down
Loading