From dae0bb54f60f1f6f68348245e490a47854a9c3a3 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Wed, 17 Jan 2024 13:09:58 +0000 Subject: [PATCH] Fix `SwiftPMWorkspace` compatibility with `targetMap` keys `ResolvedTarget` is no longer `Hashable` in SwiftPM, SourceKit-LSP should use `ResolvedTarget.ID` instead. Depends on https://github.com/apple/swift-package-manager/pull/7248. --- Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift b/Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift index ec1e46cc4..929b89b35 100644 --- a/Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift +++ b/Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift @@ -224,7 +224,7 @@ extension SwiftPMWorkspace { self.fileToTarget = [AbsolutePath: TargetBuildDescription]( packageGraph.allTargets.flatMap { target in return target.sources.paths.compactMap { - guard let td = plan.targetMap[target] else { + guard let td = plan.targetMap[target.id] else { return nil } return (key: $0, value: td) @@ -238,7 +238,7 @@ extension SwiftPMWorkspace { self.sourceDirToTarget = [AbsolutePath: TargetBuildDescription]( packageGraph.allTargets.compactMap { target in - guard let td = plan.targetMap[target] else { + guard let td = plan.targetMap[target.id] else { return nil } return (key: target.sources.root, value: td)