Use build/taskStart, build/taskProgress and build/taskFinish to communicate progress from a BSP server to the client

Instead of defining BSP extensions for `window/workDoneProgress/create` and `$/progress`, we should be able to use the standard `build/taskStart`, `build/taskProgress` and `build/taskFinish` messages to the same effect, as suggested by https://forums.swift.org/t/extending-functionality-of-build-server-protocol-with-sourcekit-lsp/74400/9.

Fixes #1783
rdar://138653131
This commit is contained in:
Alex Hoppen
2024-11-05 22:43:02 -08:00
parent c4e246b351
commit 06f58db5c8
18 changed files with 197 additions and 127 deletions

View File

@@ -394,17 +394,18 @@ package actor SwiftPMBuildSystem: BuiltInBuildSystem {
///
/// - Important: Must only be called on `packageLoadingQueue`.
private func reloadPackageAssumingOnPackageLoadingQueue() async throws {
let progressManager = WorkDoneProgressManager(
connectionToClient: self.connectionToSourceKitLSP,
waitUntilClientInitialized: {},
tokenPrefix: "package-reloading",
initialDebounce: options.workDoneProgressDebounceDurationOrDefault,
title: "SourceKit-LSP: Reloading Package"
self.connectionToSourceKitLSP.send(
TaskStartNotification(
taskId: TaskId(id: "package-reloading"),
data: WorkDoneProgressTask(title: "SourceKit-LSP: Reloading Package").encodeToLSPAny()
)
)
await testHooks.reloadPackageDidStart?()
defer {
Task {
await progressManager?.end()
self.connectionToSourceKitLSP.send(
TaskFinishNotification(taskId: TaskId(id: "package-reloading"), status: .ok)
)
await testHooks.reloadPackageDidFinish?()
}
}