public async Task SymbolsAfterPendingWaitsForUpdateAsync() { ISymbolIndex index = MakeSymbolIndex(); var path = TestData.GetDefaultModulePath(); index.Add(path, DocumentWithAst("x = 1")); index.MarkAsPending(path); var t = index.WorkspaceSymbolsAsync("", maxSymbols); index.ReIndex(path, DocumentWithAst("x = 1")); var symbols = await t; symbols.Should().BeEquivalentToWithStrictOrdering(new[] { new FlatSymbol("x", SymbolKind.Variable, path, new SourceSpan(1, 1, 1, 2)), }); }
public void MarkAsPendingWaitsForUpdates() { ISymbolIndex index = MakeSymbolIndex(); var path = TestData.GetDefaultModulePath(); index.Add(path, DocumentWithAst("x = 1")); index.MarkAsPending(path); var cts = new CancellationTokenSource(); var t = index.HierarchicalDocumentSymbolsAsync(path, cts.Token); t.IsCompleted.Should().BeFalse(); cts.Cancel(); Func <Task> cancelled = async() => { await t; }; cancelled.Should().Throw <OperationCanceledException>(); }