Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 911f1f8

Browse filesBrowse files
committed
Correct FileWatcherEventKind in server polling method
Was sending Changed on Creation. Caveat: the tests will probably still fail intermittently with a race - this just fixes the deterministic failure.
1 parent e4a6917 commit 911f1f8
Copy full SHA for 911f1f8

1 file changed

+12-6Lines changed: 12 additions & 6 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/server/server.ts‎

Copy file name to clipboardExpand all lines: src/server/server.ts
+12-6Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,18 @@ namespace ts.server {
526526
if (err) {
527527
watchedFile.callback(watchedFile.fileName, FileWatcherEventKind.Changed);
528528
}
529-
else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) {
530-
watchedFile.mtime = stats.mtime;
531-
const eventKind = watchedFile.mtime.getTime() === 0
532-
? FileWatcherEventKind.Deleted
533-
: FileWatcherEventKind.Changed;
534-
watchedFile.callback(watchedFile.fileName, eventKind);
529+
else {
530+
const oldTime = watchedFile.mtime.getTime();
531+
const newTime = stats.mtime.getTime();
532+
if (oldTime !== newTime) {
533+
watchedFile.mtime = stats.mtime;
534+
const eventKind = oldTime === 0
535+
? FileWatcherEventKind.Created
536+
: newTime === 0
537+
? FileWatcherEventKind.Deleted
538+
: FileWatcherEventKind.Changed;
539+
watchedFile.callback(watchedFile.fileName, eventKind);
540+
}
535541
}
536542
});
537543
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.