mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
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:
@@ -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?()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user