ignore disk events for files we save
This commit is contained in:
@@ -11,11 +11,12 @@ public class IdeFileChangeHandler
|
||||
GlobalEvents.Instance.FileSystemWatcherInternal.FileChanged.Subscribe(OnFileChanged);
|
||||
}
|
||||
|
||||
private async Task OnFileChanged(string arg)
|
||||
private async Task OnFileChanged(string filePath)
|
||||
{
|
||||
var sharpIdeFile = SolutionModel.AllFiles.SingleOrDefault(f => f.Path == arg);
|
||||
var sharpIdeFile = SolutionModel.AllFiles.SingleOrDefault(f => f.Path == filePath);
|
||||
if (sharpIdeFile is null) return;
|
||||
// TODO: Suppress if SharpIDE changed the file
|
||||
if (sharpIdeFile.SuppressDiskChangeEvents.Value is true) return;
|
||||
Console.WriteLine($"IdeFileChangeHandler: Changed - {filePath}");
|
||||
await sharpIdeFile.FileContentsChangedExternallyFromDisk.InvokeParallelAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +82,8 @@ public sealed class IdeFileWatcher : IDisposable
|
||||
// TODO: Make a note to users that they should not use files without extensions
|
||||
private void HandleChanged(string fullPath)
|
||||
{
|
||||
if (Path.HasExtension(fullPath) is false) return;
|
||||
Console.WriteLine($"FileSystemWatcher: Changed - {fullPath}");
|
||||
if (Path.HasExtension(fullPath) is false) return; // we don't care about directory changes
|
||||
//Console.WriteLine($"FileSystemWatcher: Changed - {fullPath}");
|
||||
GlobalEvents.Instance.FileSystemWatcherInternal.FileChanged.InvokeParallelFireAndForget(fullPath);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user