mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 12:15:34 -06:00
Do not send first missing file event as well.
This commit is contained in:
parent
0f5166535e
commit
cdf5b419f8
@ -752,12 +752,17 @@ namespace ts {
|
||||
};
|
||||
|
||||
function fileChanged(curr: any, prev: any) {
|
||||
// previous event kind check is to ensure we recongnize the file as previously also missing when it is restored or renamed twice (that is it disappears and reappears)
|
||||
// In such case, prevTime returned is same as prev time of event when file was deleted as per node documentation
|
||||
const isPreviouslyDeleted = +prev.mtime === 0 || eventKind === FileWatcherEventKind.Deleted;
|
||||
if (+curr.mtime === 0) {
|
||||
if (isPreviouslyDeleted) {
|
||||
// Already deleted file, no need to callback again
|
||||
return;
|
||||
}
|
||||
eventKind = FileWatcherEventKind.Deleted;
|
||||
}
|
||||
// previous event kind check is to ensure we send created event when file is restored or renamed twice (that is it disappears and reappears)
|
||||
// since in that case the prevTime returned is same as prev time of event when file was deleted as per node documentation
|
||||
else if (+prev.mtime === 0 || eventKind === FileWatcherEventKind.Deleted) {
|
||||
else if (isPreviouslyDeleted) {
|
||||
eventKind = FileWatcherEventKind.Created;
|
||||
}
|
||||
// If there is no change in modified time, ignore the event
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user