rename class
This commit is contained in:
@@ -17,6 +17,9 @@ public class GlobalEvents
|
||||
public FileSystemWatcherInternal FileSystemWatcherInternal { get; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// All file system events for files we have filtered for, e.g. excluding bin/obj folders. Does not filter out events triggered by us
|
||||
/// </summary>
|
||||
public class FileSystemWatcherInternal
|
||||
{
|
||||
public EventWrapper<string, Task> DirectoryCreated { get; } = new(_ => Task.CompletedTask);
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
using SharpIDE.Application.Features.Events;
|
||||
using SharpIDE.Application.Features.Analysis;
|
||||
using SharpIDE.Application.Features.Evaluation;
|
||||
using SharpIDE.Application.Features.Events;
|
||||
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
||||
|
||||
namespace SharpIDE.Application.Features.FileWatching;
|
||||
|
||||
public class IdeFileChangeHandler
|
||||
public class IdeFileExternalChangeHandler
|
||||
{
|
||||
public SharpIdeSolutionModel SolutionModel { get; set; } = null!;
|
||||
public IdeFileChangeHandler()
|
||||
public IdeFileExternalChangeHandler()
|
||||
{
|
||||
GlobalEvents.Instance.FileSystemWatcherInternal.FileChanged.Subscribe(OnFileChanged);
|
||||
}
|
||||
@@ -27,5 +29,18 @@ public class IdeFileChangeHandler
|
||||
}
|
||||
Console.WriteLine($"IdeFileChangeHandler: Changed - {filePath}");
|
||||
await sharpIdeFile.FileContentsChangedExternallyFromDisk.InvokeParallelAsync();
|
||||
if (sharpIdeFile.IsCsprojFile)
|
||||
{
|
||||
await HandleCsprojChanged(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task HandleCsprojChanged(string filePath)
|
||||
{
|
||||
var project = SolutionModel.AllProjects.SingleOrDefault(p => p.FilePath == filePath);
|
||||
if (project is null) return;
|
||||
await ProjectEvaluation.ReloadProject(filePath);
|
||||
await RoslynAnalysis.ReloadProject(project);
|
||||
await RoslynAnalysis.UpdateSolutionDiagnostics();
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public partial class IdeRoot : Control
|
||||
Singletons.FileWatcher?.Dispose();
|
||||
Singletons.FileWatcher = new IdeFileWatcher();
|
||||
Singletons.FileManager = new IdeFileManager();
|
||||
Singletons.FileChangeHandler = new IdeFileChangeHandler();
|
||||
Singletons.FileExternalChangeHandler = new IdeFileExternalChangeHandler();
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
@@ -127,7 +127,7 @@ public partial class IdeRoot : Control
|
||||
_bottomPanelManager.Solution = solutionModel;
|
||||
_searchWindow.Solution = solutionModel;
|
||||
_searchAllFilesWindow.Solution = solutionModel;
|
||||
Singletons.FileChangeHandler.SolutionModel = solutionModel;
|
||||
Singletons.FileExternalChangeHandler.SolutionModel = solutionModel;
|
||||
Callable.From(_solutionExplorerPanel.RepopulateTree).CallDeferred();
|
||||
RoslynAnalysis.StartSolutionAnalysis(solutionModel);
|
||||
Singletons.FileWatcher.StartWatching(solutionModel);
|
||||
|
||||
@@ -12,6 +12,6 @@ public static class Singletons
|
||||
public static BuildService BuildService { get; set; } = null!;
|
||||
public static IdeFileWatcher FileWatcher { get; set; } = null!;
|
||||
public static IdeFileManager FileManager { get; set; } = null!;
|
||||
public static IdeFileChangeHandler FileChangeHandler { get; set; } = null!;
|
||||
public static IdeFileExternalChangeHandler FileExternalChangeHandler { get; set; } = null!;
|
||||
public static AppState AppState { get; set; } = null!;
|
||||
}
|
||||
Reference in New Issue
Block a user