Skip to content

Commit

Permalink
chore: Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
dr1rrb committed Dec 17, 2024
1 parent a46202a commit f1ee367
Showing 1 changed file with 0 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -604,39 +604,6 @@ public void Dispose()
}

#region Helpers
private static IObservable<IList<string>> ToObservable(params FileSystemWatcher[] watchers)
=> Observable.Defer(() =>
{
// Create an observable instead of using the FromEventPattern which
// does not register to events properly.
// Renames are required for the WriteTemporary->DeleteOriginal->RenameToOriginal that
// Visual Studio uses to save files.

var subject = new Subject<string>();

void changed(object s, FileSystemEventArgs args) => subject.OnNext(args.FullPath);
void renamed(object s, RenamedEventArgs args) => subject.OnNext(args.FullPath);

foreach (var watcher in watchers)
{
watcher.Changed += changed;
watcher.Created += changed;
watcher.Renamed += renamed;
}

return subject
.Buffer(() => subject.Throttle(TimeSpan.FromMilliseconds(250))) // Wait for 250 ms without any file change
.Finally(() =>
{
foreach (var watcher in watchers)
{
watcher.Changed -= changed;
watcher.Created -= changed;
watcher.Renamed -= renamed;
}
});
});

private static IObservable<Task<ImmutableHashSet<string>>> To2StepsObservable(FileSystemWatcher[] watchers, Predicate<string> filter)
=> Observable.Create<Task<ImmutableHashSet<string>>>(o =>
{
Expand Down

0 comments on commit f1ee367

Please sign in to comment.