Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit 56d8e79

Browse files
author
MikhailArkhipov
committed
PR feedback
1 parent a96aa99 commit 56d8e79

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

  • src/LanguageServer/Impl/Implementation

src/LanguageServer/Impl/Implementation/Server.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -618,26 +618,24 @@ internal Task EnqueueItemAsync(IDocument doc, AnalysisPriority priority = Analys
618618
// It is called from DidChangeTextDocument which must fully finish
619619
// since otherwise Complete() may come before the change is enqueued
620620
// for processing and the completion list will be driven off the stale data.
621-
return cookieTask.ContinueWith(async t => {
621+
return cookieTask.ContinueWith(t => {
622622
if (t.IsFaulted) {
623623
// Happens when file got deleted before processing
624624
pending.Dispose();
625625
LogMessage(MessageType.Error, t.Exception.Message);
626626
return;
627627
}
628-
_shutdownCts.Token.ThrowIfCancellationRequested();
629-
await OnDocumentChangeProcessingCompleteAsync(doc, t.Result as VersionCookie, enqueueForAnalysis, priority, pending);
628+
OnDocumentChangeProcessingComplete(doc, t.Result as VersionCookie, enqueueForAnalysis, priority, pending);
630629
});
631630
} catch {
632631
pending?.Dispose();
633632
throw;
634633
}
635634
}
636635

637-
private async Task OnDocumentChangeProcessingCompleteAsync(IDocument doc, VersionCookie vc, bool enqueueForAnalysis, AnalysisPriority priority, IDisposable disposeWhenEnqueued) {
636+
private void OnDocumentChangeProcessingComplete(IDocument doc, VersionCookie vc, bool enqueueForAnalysis, AnalysisPriority priority, IDisposable disposeWhenEnqueued) {
638637
try {
639638
_shutdownCts.Token.ThrowIfCancellationRequested();
640-
_disposableBag.ThrowIfDisposed();
641639
if (vc != null) {
642640
foreach (var kv in vc.GetAllParts(doc.DocumentUri)) {
643641
ParseComplete(kv.Key, kv.Value.Version);
@@ -646,8 +644,7 @@ private async Task OnDocumentChangeProcessingCompleteAsync(IDocument doc, Versio
646644
ParseComplete(doc.DocumentUri, 0);
647645
}
648646

649-
if (doc is IAnalyzable analyzable && enqueueForAnalysis) {
650-
_shutdownCts.Token.ThrowIfCancellationRequested();
647+
if (doc is IAnalyzable analyzable && enqueueForAnalysis && !_shutdownCts.Token.IsCancellationRequested) {
651648
AnalysisQueued(doc.DocumentUri);
652649
AnalysisQueue.Enqueue(analyzable, priority);
653650
}
@@ -658,7 +655,6 @@ private async Task OnDocumentChangeProcessingCompleteAsync(IDocument doc, Versio
658655
_editorFiles.GetDocument(doc.DocumentUri).UpdateParseDiagnostics(vc, doc.DocumentUri);
659656
}
660657
} catch (BadSourceException) {
661-
} catch (ObjectDisposedException) when (_disposableBag.IsDisposed) {
662658
} catch (OperationCanceledException ex) {
663659
LogMessage(MessageType.Warning, $"Parsing {doc.DocumentUri} cancelled");
664660
TraceMessage($"{ex}");

0 commit comments

Comments
 (0)