@@ -424,15 +424,15 @@ final class SKTests: XCTestCase {
424
424
"""
425
425
class Foo {
426
426
func slow(x: Invalid1, y: Invalid2) {
427
- x / y / x / y / x / y / x / y . 1️⃣
427
+ 1️⃣ x / y / x / y / x / y / x / y . 2️⃣
428
428
}
429
429
430
430
struct Foo {
431
- let fooMember : String
431
+ let 3️⃣fooMember : String
432
432
}
433
433
434
434
func fast(a: Foo) {
435
- a.2️⃣
435
+ a.4️⃣
436
436
}
437
437
}
438
438
""" ,
@@ -443,7 +443,7 @@ final class SKTests: XCTestCase {
443
443
444
444
let requestID = RequestID . string ( " cancellation-test " )
445
445
testClient. server. handle (
446
- CompletionRequest ( textDocument: TextDocumentIdentifier ( uri) , position: positions [ " 1️⃣ " ] ) ,
446
+ CompletionRequest ( textDocument: TextDocumentIdentifier ( uri) , position: positions [ " 2️⃣ " ] ) ,
447
447
id: requestID,
448
448
from: ObjectIdentifier ( self )
449
449
) { reply in
@@ -461,9 +461,26 @@ final class SKTests: XCTestCase {
461
461
462
462
let fastStartDate = Date ( )
463
463
let fastReply = try await testClient. send (
464
- CompletionRequest ( textDocument: TextDocumentIdentifier ( uri) , position: positions [ " 2️⃣ " ] )
464
+ CompletionRequest ( textDocument: TextDocumentIdentifier ( uri) , position: positions [ " 4️⃣ " ] )
465
465
)
466
466
XCTAssert ( !fastReply. items. isEmpty)
467
467
XCTAssertLessThan ( Date ( ) . timeIntervalSince ( fastStartDate) , 2 , " Fast request wasn't actually fast " )
468
+
469
+ // Remove the slow-to-typecheck line. This causes the implicit diagnostics request for the push diagnostics
470
+ // notification to get cancelled, which unblocks sourcekitd for later tests.
471
+ testClient. send (
472
+ DidChangeTextDocumentNotification (
473
+ textDocument: VersionedTextDocumentIdentifier ( uri, version: 2 ) ,
474
+ contentChanges: [
475
+ TextDocumentContentChangeEvent ( range: positions [ " 1️⃣ " ] ..< positions [ " 2️⃣ " ] , text: " " )
476
+ ]
477
+ )
478
+ )
479
+
480
+ // Check that semantic functionality based on the AST is working again.
481
+ let symbolInfo = try await testClient. send (
482
+ SymbolInfoRequest ( textDocument: TextDocumentIdentifier ( uri) , position: positions [ " 3️⃣ " ] )
483
+ )
484
+ XCTAssertGreaterThan ( symbolInfo. count, 0 )
468
485
}
469
486
}
0 commit comments