Skip to content

Commit 069e8a2

Browse files
committed
Call indexProgressManager.indexStatusDidChange when workspaces in the SourceKitLSPServer are modified
`IndexProgressManager` iterates over all workspaces in the SourceKitLSPServer. Modifying workspaces might thus update the index progress status.
1 parent eb784eb commit 069e8a2

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Sources/SourceKitLSP/SourceKitLSPServer.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,9 @@ public actor SourceKitLSPServer {
508508
private var workspacesAndIsImplicit: [(workspace: Workspace, isImplicit: Bool)] = [] {
509509
didSet {
510510
uriToWorkspaceCache = [:]
511+
// `indexProgressManager` iterates over all workspaces in the SourceKitLSPServer. Modifying workspaces might thus
512+
// update the index progress status.
513+
indexProgressManager.indexStatusDidChange()
511514
}
512515
}
513516

Tests/SourceKitLSPTests/BackgroundIndexingTests.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -384,21 +384,19 @@ final class BackgroundIndexingTests: XCTestCase {
384384
XCTAssertEqual(beginData.message, "Generating build graph")
385385
let indexingWorkDoneProgressToken = beginNotification.token
386386

387-
let reportNotification = try await project.testClient.nextNotification(
387+
_ = try await project.testClient.nextNotification(
388388
ofType: WorkDoneProgress.self,
389389
satisfying: { notification in
390-
guard notification.token == indexingWorkDoneProgressToken, case .report = notification.value else {
390+
guard notification.token == indexingWorkDoneProgressToken,
391+
case .report(let reportData) = notification.value,
392+
reportData.message == "0 / 1"
393+
else {
391394
return false
392395
}
393396
return true
394397
}
395398
)
396399
receivedReportProgressNotification.fulfill()
397-
guard case .report(let reportData) = reportNotification.value else {
398-
XCTFail("Expected report notification")
399-
return
400-
}
401-
XCTAssertEqual(reportData.message, "0 / 1")
402400

403401
_ = try await project.testClient.nextNotification(
404402
ofType: WorkDoneProgress.self,

0 commit comments

Comments
 (0)