diff --git a/src/LanguageServer/Impl/Indexing/MostRecentDocumentSymbols.cs b/src/LanguageServer/Impl/Indexing/MostRecentDocumentSymbols.cs index e1739af6e..0717f5c0b 100644 --- a/src/LanguageServer/Impl/Indexing/MostRecentDocumentSymbols.cs +++ b/src/LanguageServer/Impl/Indexing/MostRecentDocumentSymbols.cs @@ -70,7 +70,7 @@ public async Task WorkAndSetTcs(Func> GetSymbolsAsync(CancellationToken ct = default) { lock (_syncObj) { - return _fileTcs.Task; + return _fileTcs.Task.WaitAsync(ct); } } @@ -111,6 +111,7 @@ public void Dispose() { } _state = WorkQueueState.FinishedWork; } + _fileCts?.Dispose(); } private async Task> IndexAsync(IDocument doc, CancellationToken indexCt) { @@ -150,6 +151,7 @@ private async Task> ParseAsync(CancellationTok private void RenewTcs() { Check.InvalidOperation(Monitor.IsEntered(_syncObj)); + _fileCts?.Dispose(); _fileCts = new CancellationTokenSource(); _fileTcs = new TaskCompletionSource>(); }