batch selection changed calculations

This commit is contained in:
Matt Parker
2025-12-18 12:11:48 +10:00
parent bc5468cd64
commit f640958c7c
2 changed files with 40 additions and 14 deletions

View File

@@ -25,13 +25,12 @@ public class FileChangedService
private readonly RoslynAnalysis _roslynAnalysis;
private readonly IdeOpenTabsFileManager _openTabsFileManager;
private readonly AsyncBatchingWorkQueue _updateSolutionDiagnosticsQueue;
public static readonly IAsynchronousOperationListener NullListener = new AsynchronousOperationListenerProvider.NullOperationListener();
public FileChangedService(RoslynAnalysis roslynAnalysis, IdeOpenTabsFileManager openTabsFileManager)
{
_roslynAnalysis = roslynAnalysis;
_openTabsFileManager = openTabsFileManager;
_updateSolutionDiagnosticsQueue = new AsyncBatchingWorkQueue(TimeSpan.FromMilliseconds(200), ProcessBatchAsync, NullListener, CancellationToken.None);
_updateSolutionDiagnosticsQueue = new AsyncBatchingWorkQueue(TimeSpan.FromMilliseconds(200), ProcessBatchAsync, IAsynchronousOperationListener.Instance, CancellationToken.None);
}
public SharpIdeSolutionModel SolutionModel { get; set; } = null!;
@@ -177,3 +176,12 @@ public class FileChangedService
_updateSolutionDiagnosticsQueue.AddWork();
}
}
public static class NullOperationListenerExtensions
{
private static readonly IAsynchronousOperationListener _nullOperationListener = new AsynchronousOperationListenerProvider.NullOperationListener();
extension(IAsynchronousOperationListener nullOperationListener)
{
public static IAsynchronousOperationListener Instance => _nullOperationListener;
}
}