Skip to content

Commit 76684c7

Browse files
committed
Capture the SourceKitServer weakly in reloadPackageStatusCallback
If the `SourceKitServer` doesn’t have any other references anymore the LSP client is shutting down and there’s no point status updates from package reloading anymore.
1 parent 9888741 commit 76684c7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/SourceKitLSP/SourceKitServer.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,8 @@ extension SourceKitServer {
11291129
buildSetup: self.options.buildSetup.merging(workspaceBuildSetup),
11301130
compilationDatabaseSearchPaths: self.options.compilationDatabaseSearchPaths,
11311131
indexOptions: self.options.indexOptions,
1132-
reloadPackageStatusCallback: { status in
1132+
reloadPackageStatusCallback: { [weak self] status in
1133+
guard let self else { return }
11331134
guard capabilityRegistry.clientCapabilities.window?.workDoneProgress ?? false else {
11341135
// Client doesn’t support work done progress
11351136
return

0 commit comments

Comments
 (0)