public ErrorsSnapshotFactory(IDiagnosticService diagnosticService, DocumentId documentId) { _diagnosticService = diagnosticService; _documentId = documentId; _workQueue = new AsynchronousSerialWorkQueue(new AsynchronousOperationListener()); _currentSnapshot = new ErrorsSnapshot(ImmutableArray <MappedDiagnostic> .Empty, 0); }
private async Task UpdateCurrentSnapshotAsync(CancellationToken cancellationToken) { var diagnostics = await _diagnosticService .GetDiagnosticsAsync(_documentId, cancellationToken) .ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); var snapshot = new ErrorsSnapshot( diagnostics, _currentSnapshot.VersionNumber + 1); _currentSnapshot = snapshot; }