Skip to content

Commit

Permalink
Request completions until timeout in LSP tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich committed Jul 26, 2024
1 parent 50c401d commit cce743f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/OmniSharp.Lsp.Tests/OmnisharpCompletionHandlerFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1561,11 +1561,18 @@ private async Task<CompletionList> FindCompletionsWithImportedAsync(string filen
return completions;
}

// Populating the completion list should take no more than a few ms, don't let it take too
// Populating the completion cache should take no more than a few ms, don't let it take too
// long
await Task.Delay(ImportCompletionTimeout);

completions = await FindCompletionsAsync(filename, source);
CancellationTokenSource cts = new CancellationTokenSource(millisecondsDelay: ImportCompletionTimeout);
await Task.Run(async () =>
{
while (completions.IsIncomplete)
{
await Task.Delay(100);
completions = await FindCompletionsAsync(filename, source);
cts.Token.ThrowIfCancellationRequested();
}
}, cts.Token);

Assert.False(completions.IsIncomplete);
return completions;
Expand Down

0 comments on commit cce743f

Please sign in to comment.