Skip to content

Commit 9ceedcd

Browse files
committed
Make testImplicitCancellationOnEdit more robust
Instead of adding an arbitrary `Task.sleep` that should give us enough time to send the `textDocument/didChange` notification, wait until we receive the cancellation from the document change.
1 parent b3a73f6 commit 9ceedcd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Tests/SourceKitLSPTests/SemanticTokensTests.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,9 @@ final class SemanticTokensTests: XCTestCase {
897897
let testClient = try await TestSourceKitLSPClient(
898898
hooks: Hooks(preHandleRequest: { request in
899899
if request is DocumentSemanticTokensRequest {
900-
// Sleep long enough for the edit to be handled
901-
try? await Task.sleep(for: .seconds(10))
900+
while !Task.isCancelled {
901+
try? await Task.sleep(for: .seconds(1))
902+
}
902903
}
903904
})
904905
)

0 commit comments

Comments
 (0)